[packages/python-ukpostcodeparser] - new

qboosh qboosh at pld-linux.org
Fri Oct 20 17:41:27 CEST 2023


commit 2fa93ff849aa93b7252b56e0f6c63adb57fd5377
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri Oct 20 17:43:24 2023 +0200

    - new

 UkPostcodeParser-tests.patch |  59 ++++++++++++++++++++++++
 python-ukpostcodeparser.spec | 105 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 164 insertions(+)
---
diff --git a/python-ukpostcodeparser.spec b/python-ukpostcodeparser.spec
new file mode 100644
index 0000000..02cbc9d
--- /dev/null
+++ b/python-ukpostcodeparser.spec
@@ -0,0 +1,105 @@
+#
+# Conditional build:
+%bcond_without	tests	# unit tests
+%bcond_without	python2 # CPython 2.x module
+%bcond_without	python3 # CPython 3.x module
+
+Summary:	UK Postcode parser
+Summary(pl.UTF-8):	Analizator kodów pocztowych Wielkiej Brytanii
+Name:		python-ukpostcodeparser
+Version:	1.1.2
+Release:	1
+License:	MIT
+Group:		Libraries/Python
+#Source0Download: https://pypi.org/simple/UkPostcodeParser/
+Source0:	https://files.pythonhosted.org/packages/source/U/UkPostcodeParser/UkPostcodeParser-%{version}.tar.gz
+# Source0-md5:	763ed9144915f9647fa5bded2f03ae75
+Patch0:		UkPostcodeParser-tests.patch
+URL:		https://pypi.org/project/UkPostcodeParser/
+%if %{with python2}
+BuildRequires:	python-modules >= 1:2.5
+BuildRequires:	python-setuptools
+%endif
+%if %{with python3}
+BuildRequires:	python3-modules >= 1:3.2
+BuildRequires:	python3-setuptools
+%endif
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
+Requires:	python-modules >= 1:2.5
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+UK Postcode parser.
+
+%description -l pl.UTF-8
+Analizator kodów pocztowych Wielkiej Brytanii.
+
+%package -n python3-ukpostcodeparser
+Summary:	UK Postcode parser
+Summary(pl.UTF-8):	Analizator kodów pocztowych Wielkiej Brytanii
+Group:		Libraries/Python
+Requires:	python3-modules >= 1:3.2
+
+%description -n python3-ukpostcodeparser
+UK Postcode parser.
+
+%description -n python3-ukpostcodeparser -l pl.UTF-8
+Analizator kodów pocztowych Wielkiej Brytanii.
+
+%prep
+%setup -q -n UkPostcodeParser-%{version}
+%patch0 -p1
+
+%build
+%if %{with python2}
+%py_build
+
+%if %{with tests}
+%{__python} -m unittest ukpostcodeparser.test.parser
+%endif
+%endif
+
+%if %{with python3}
+%py3_build
+
+%if %{with tests}
+%{__python3} -m unittest ukpostcodeparser.test.parser
+%endif
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%py_install
+
+%{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/ukpostcodeparser/test
+%py_postclean
+%endif
+
+%if %{with python3}
+%py3_install
+
+%{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/ukpostcodeparser/test
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%files
+%defattr(644,root,root,755)
+%doc LICENSE README
+%{py_sitescriptdir}/ukpostcodeparser
+%{py_sitescriptdir}/UkPostcodeParser-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-ukpostcodeparser
+%defattr(644,root,root,755)
+%doc LICENSE README
+%{py3_sitescriptdir}/ukpostcodeparser
+%{py3_sitescriptdir}/UkPostcodeParser-%{version}-py*.egg-info
+%endif
diff --git a/UkPostcodeParser-tests.patch b/UkPostcodeParser-tests.patch
new file mode 100644
index 0000000..af03c44
--- /dev/null
+++ b/UkPostcodeParser-tests.patch
@@ -0,0 +1,59 @@
+Update tests for new central London outing codes added in 9f7563d.
+Remove duplicates.
+--- UkPostcodeParser-1.1.2/ukpostcodeparser/test/parser.py.orig	2017-07-04 01:13:59.000000000 +0200
++++ UkPostcodeParser-1.1.2/ukpostcodeparser/test/parser.py	2023-10-20 16:51:43.328113015 +0200
+@@ -801,7 +801,7 @@ class PostcodeTestCase(unittest.TestCase
+             postcode='w1m 4zz',
+             strict=True,
+             incode_mandatory=False,
+-            expected=InvalidPostcodeError
++            expected=('W1M','4ZZ')
+         )
+ 
+     def test_092(self):
+@@ -844,20 +844,12 @@ class PostcodeTestCase(unittest.TestCase
+             expected=('GIR', '')
+         )
+ 
+-    def test_097(self):
+-        self.run_parser(
+-            postcode='w1m 4zz',
+-            strict=True,
+-            incode_mandatory=False,
+-            expected=InvalidPostcodeError
+-        )
+-
+     def test_098(self):
+         self.run_parser(
+             postcode='w1m',
+             strict=True,
+             incode_mandatory=False,
+-            expected=InvalidPostcodeError
++            expected=('W1M', '')
+         )
+ 
+     def test_099(self):
+@@ -1073,7 +1065,7 @@ class PostcodeTestCase(unittest.TestCase
+             postcode='w1m 4zz',
+             strict=True,
+             incode_mandatory=True,
+-            expected=InvalidPostcodeError
++            expected=('W1M', '4ZZ')
+         )
+ 
+     def test_126(self):
+@@ -1116,14 +1108,6 @@ class PostcodeTestCase(unittest.TestCase
+             expected=IncodeNotFoundError
+         )
+ 
+-    def test_131(self):
+-        self.run_parser(
+-            postcode='w1m 4zz',
+-            strict=True,
+-            incode_mandatory=True,
+-            expected=InvalidPostcodeError
+-        )
+-
+     def test_132(self):
+         self.run_parser(
+             postcode='w1m',
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-ukpostcodeparser.git/commitdiff/2fa93ff849aa93b7252b56e0f6c63adb57fd5377



More information about the pld-cvs-commit mailing list