[packages/python-configparser] - nicer way to avoiding pth files

arekm arekm at pld-linux.org
Fri Nov 30 11:21:10 CET 2018


commit b49244b801882d23a4bc2e7fd8a1b8b26136fc5d
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Fri Nov 30 11:21:00 2018 +0100

    - nicer way to avoiding pth files

 backports-dont-use-setuptools-namespace.patch | 11 +++++++++++
 python-configparser.spec                      | 12 +++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/python-configparser.spec b/python-configparser.spec
index c970e54..c558e39 100644
--- a/python-configparser.spec
+++ b/python-configparser.spec
@@ -14,6 +14,8 @@ Group:		Libraries/Python
 #Source0Download: https://pypi.python.org/simple/configparser/
 Source0:	https://files.pythonhosted.org/packages/source/c/configparser/configparser-%{version}.tar.gz
 # Source0-md5:	cfdd915a5b7a6c09917a64a573140538
+# https://bitbucket.org/ambv/configparser/issues/21/configparser-should-not-declare-a
+Patch0:		backports-dont-use-setuptools-namespace.patch
 URL:		https://pypi.python.org/pypi/configparser
 %if %{with python2}
 BuildRequires:	python >= 1:2.6
@@ -62,6 +64,7 @@ bezpośrednio w Pythonie 2.6 - 3.5.
 
 %prep
 %setup -q -n configparser-%{version}
+%patch0 -p1
 
 %build
 %if %{with python2}
@@ -80,19 +83,14 @@ rm -rf $RPM_BUILD_ROOT
 
 %py_postclean
 
-# pth file is for both import versions to work on python2: "import configparser" and "from backports import configparser"
-# but doing that with pth code hacks bereaks other ptyhon-backports packages.
-rm -f $RPM_BUILD_ROOT%{py_sitescriptdir}/configparser-%{version}-py*-nspkg.pth
-# so intead of pth hacks we symlink module which is not exactly the same behaviour but is good enough for us
+# https://bitbucket.org/ambv/configparser/issues/21/configparser-should-not-declare-a
+# hack for: import configparser and from backports import configparser to work
 ln -s ../../configparser.pyc $RPM_BUILD_ROOT%{py_sitescriptdir}/backports/configparser/
 ln -s ../../configparser.pyo $RPM_BUILD_ROOT%{py_sitescriptdir}/backports/configparser/
 %endif
 
 %if %{with python3}
 %py3_install
-
-# See note for python2. On python3 we rely on python-backports.spec infrastructure.
-rm -f $RPM_BUILD_ROOT%{py3_sitescriptdir}/configparser-%{version}-py*-nspkg.pth
 %endif
 
 %clean
diff --git a/backports-dont-use-setuptools-namespace.patch b/backports-dont-use-setuptools-namespace.patch
new file mode 100644
index 0000000..f081adc
--- /dev/null
+++ b/backports-dont-use-setuptools-namespace.patch
@@ -0,0 +1,11 @@
+diff -urN configparser-3.5.0.org/setup.py configparser-3.5.0/setup.py
+--- configparser-3.5.0.org/setup.py	2016-05-21 10:14:22.000000000 +0200
++++ configparser-3.5.0/setup.py	2018-11-30 11:17:12.134505201 +0100
+@@ -42,7 +42,6 @@
+     py_modules=modules,
+     package_dir={'': 'src'},
+     packages=find_packages('src'),
+-    namespace_packages=['backports'],
+     include_package_data=True,
+     zip_safe=False,
+     install_requires=requirements,
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-configparser.git/commitdiff/b49244b801882d23a4bc2e7fd8a1b8b26136fc5d



More information about the pld-cvs-commit mailing list