15
0

Accepting request 674603 from home:mcepl

- Add python3-fixes.patch to make tests pass.

OBS-URL: https://build.opensuse.org/request/show/674603
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-parse_type?expand=0&rev=1
This commit is contained in:
2019-02-13 15:02:45 +00:00
committed by Git OBS Bridge
commit 3736402be4
6 changed files with 239 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

3
parse_type-0.4.2.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f596bdc75d3dd93036fbfe3d04127da9f6df0c26c36e01e76da85adef4336b3c
size 264473

View File

@@ -0,0 +1,9 @@
-------------------------------------------------------------------
Wed Feb 13 14:55:24 UTC 2019 - Matěj Cepl <mcepl@suse.com>
- Add python3-fixes.patch to make tests pass.
-------------------------------------------------------------------
Wed Nov 28 20:49:13 UTC 2018 - Mathias Homann <Mathias.Homann@opensuse.org>
- initial package using py2pack and version 0.4.2

79
python-parse_type.spec Normal file
View File

@@ -0,0 +1,79 @@
#
# spec file for package python-parse_type
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-parse_type
Version: 0.4.2
Release: 0
License: BSD-3-Clause
Summary: Simplifies to build parse types based on the parse module
Url: https://github.com/jenisys/parse_type
Group: Development/Languages/Python
Source: https://files.pythonhosted.org/packages/source/p/parse_type/parse_type-%{version}.tar.gz
# PATCH-FIX-UPSTREAM python3-fixes.patch gh#jenisys/parse_type#13 mcepl@suse.com
Patch0: python3-fixes.patch
BuildRequires: python-rpm-macros
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
# SECTION test requirements
BuildRequires: %{python_module parse >= 1.8}
BuildRequires: %{python_module six >= 1.11}
BuildRequires: %{python_module pytest >= 3.0}
# /SECTION
BuildRequires: fdupes
Requires: python-parse >= 1.8
Requires: python-six >= 1.11
Suggests: python-enum34
Suggests: python-ordereddict
Suggests: python-coverage
Suggests: python-pytest >= 3.0
Suggests: python-pytest-cov
Suggests: python-tox
Suggests: python-sphinx >= 1.2
BuildArch: noarch
%python_subpackages
%description
parse_type extends the parse module (opposite of string.format()) with
the following features:
* build type converters for common use cases (enum/mapping, choice)
* build a type converter with a cardinality constraint (0..1, 0..*, 1..*)
from the type converter with cardinality=1.
* compose a type converter from other type converters
* an extended parser that supports the CardinalityField naming schema
and creates missing type variants (0..1, 0..*, 1..*) from the
primary type converter
%prep
%setup -q -n parse_type-%{version}
%autopatch -p1
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%files %{python_files}
%doc LICENSE README.rst
%{python_sitelib}/*
%changelog

124
python3-fixes.patch Normal file
View File

@@ -0,0 +1,124 @@
--- a/parse_type/parse_util.py
+++ b/parse_type/parse_util.py
@@ -6,7 +6,7 @@ Provides generic utility classes for the
from __future__ import absolute_import
from collections import namedtuple
-import parse
+from . import parse
import six
--- a/parse_type/cardinality_field.py
+++ b/parse_type/cardinality_field.py
@@ -98,7 +98,7 @@ class CardinalityFieldTypeBuilder(object
.. code-block:: python
- import parse
+ from . import parse
@parse.with_pattern(r'\d+')
def parse_number(text):
--- a/parse_type/cfparse.py
+++ b/parse_type/cfparse.py
@@ -7,7 +7,7 @@ cardinality fields in (user-defined) typ
from __future__ import absolute_import
from .cardinality_field import CardinalityField, CardinalityFieldTypeBuilder
from .parse_util import FieldParser
-import parse
+from . import parse
import logging
--- a/parse_type/parse.py
+++ b/parse_type/parse.py
@@ -383,7 +383,7 @@ def with_pattern(pattern):
This annotates the type converter with the :attr:`pattern` attribute.
EXAMPLE:
- >>> import parse
+ >>> from . import parse
>>> @parse.with_pattern(r"\d+")
... def parse_number(text):
... return int(text)
--- a/tests/test_builder.py
+++ b/tests/test_builder.py
@@ -12,7 +12,7 @@ from .parse_type_test \
import parse_number, parse_yesno, parse_person_choice, parse_color, Color
from parse_type import TypeBuilder, build_type_dict
from enum import Enum
-import parse
+from parse_type import parse
import re
import unittest
--- a/tests/test_cardinality.py
+++ b/tests/test_cardinality.py
@@ -8,7 +8,7 @@ from __future__ import absolute_import
from .parse_type_test import ParseTypeTestCase, parse_number
from parse_type import Cardinality, TypeBuilder, build_type_dict
from parse_type.parse import Parser as ParserExt
-import parse
+from parse_type import parse
import unittest
# -----------------------------------------------------------------------------
--- a/tests/test_cardinality_field0.py
+++ b/tests/test_cardinality_field0.py
@@ -19,7 +19,7 @@ STATUS:
from __future__ import absolute_import
from .parse_type_test import ParseTypeTestCase
from parse_type import TypeBuilder, build_type_dict
-import parse
+from parse_type import parse
import unittest
ENABLED = False
--- a/tests/test_parse_decorator.py
+++ b/tests/test_parse_decorator.py
@@ -7,7 +7,7 @@ Integrated into :mod:`parse` module.
from __future__ import absolute_import
from .parse_type_test import ParseTypeTestCase
from parse_type import build_type_dict
-import parse
+from parse_type import parse
import unittest
@@ -24,7 +24,7 @@ class TestParseTypeWithPatternDecorator(
is equivalent to:
- >>> import parse
+ >>> from . import parse
>>> @parse.with_pattern(r"\d+")
... def parse_number(text):
... return int(text)
--- a/tests/test_parse_type_parse.py
+++ b/tests/test_parse_type_parse.py
@@ -13,10 +13,6 @@ See the end of the source file for the l
from __future__ import absolute_import
import unittest
-try:
- import unittest2 as unittest
-except ImportError:
- import unittest
# -- ADAPTATION-END
from datetime import datetime, time
import re
--- a/tests/parse_type_test.py
+++ b/tests/parse_type_test.py
@@ -3,10 +3,7 @@
from __future__ import absolute_import
from parse_type import TypeBuilder
from enum import Enum
-try:
- import unittest2 as unittest
-except ImportError:
- import unittest
+import unittest
# -----------------------------------------------------------------------------