[packages/python-traitlets] - cleaned up the mess - added use-setuptools patch (use setuptools to generate pythonegg dependencie

qboosh qboosh at pld-linux.org
Sat Sep 21 21:59:59 CEST 2019


commit b460cd269f2fd732a17d974c961355304bc9adee
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sat Sep 21 22:02:18 2019 +0200

    - cleaned up the mess
    - added use-setuptools patch (use setuptools to generate pythonegg dependencies)
    - release 4

 python-traitlets-use-setuptools.patch |  11 +++
 python-traitlets.spec                 | 123 +++++++++++++++++++---------------
 2 files changed, 80 insertions(+), 54 deletions(-)
---
diff --git a/python-traitlets.spec b/python-traitlets.spec
index abeaea8..8651237 100644
--- a/python-traitlets.spec
+++ b/python-traitlets.spec
@@ -1,63 +1,83 @@
-# TODO:
-# - fix docs
+#
 # Conditional build:
-%bcond_with	doc	# don't build doc
-%bcond_with	tests	# do not perform "make test"
+%bcond_without	doc	# API documentation
+%bcond_without	tests	# unit tests
 %bcond_without	python2 # CPython 2.x module
 %bcond_without	python3 # CPython 3.x module
 
-# NOTE: 'module' should match the python import path, not the egg name
 %define 	module	traitlets
 Summary:	A configuration system for Python applications
-Summary(pl.UTF-8):	System konfiguracji dla aplikacji w Pythonie.
+Summary(pl.UTF-8):	System konfiguracji dla aplikacji w Pythonie
 Name:		python-%{module}
 Version:	4.3.2
-Release:	3
+Release:	4
 License:	BSD
 Group:		Libraries/Python
+#Source0Download: https://github.com/ipython/traitlets/releases
+# TODO:		https://github.com/ipython/traitlets/archive/%{version}/%{module}-%{version}.tar.gz
 Source0:	https://github.com/ipython/traitlets/archive/%{version}.tar.gz
 # Source0-md5:	0b5b7986aef676d12f31a16cbbe3ed92
+Patch0:		%{name}-use-setuptools.patch
 URL:		https://traitlets.readthedocs.io/en/stable/
-BuildRequires:	rpm-pythonprov
-# for the py_build, py_install macros
-BuildRequires:	rpmbuild(macros) >= 1.714
 %if %{with python2}
-BuildRequires:	python-modules
+BuildRequires:	python-modules >= 1:2.7
 BuildRequires:	python-setuptools
-BuildRequires:	python-sphinx_rtd_theme
+%if %{with tests}
+BuildRequires:	python-decorator
+BuildRequires:	python-enum34
+BuildRequires:	python-mock
+BuildRequires:	python-pytest
+BuildRequires:	python-six
+%endif
 %endif
 %if %{with python3}
-BuildRequires:	python3-modules
+BuildRequires:	python3-modules >= 1:3.3
 BuildRequires:	python3-setuptools
+%if %{with tests}
+BuildRequires:	python3-decorator
+%if "%{py3_ver}" < "3.4"
+BuildRequires:	python3-enum34
+%endif
+BuildRequires:	python3-pytest
+BuildRequires:	python3-six
+%endif
+%endif
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
+%if %{with doc}
+BuildRequires:	python3-ipython_genutils
 BuildRequires:	python3-sphinx_rtd_theme
-
+BuildRequires:	sphinx-pdg-3
 %endif
-# when using /usr/bin/env or other in-place substitutions
-#BuildRequires:	sed >= 4.0
-# replace with other requires if defined in setup.py
-Requires:	python-decorator
-Requires:	python-modules
+Requires:	python-modules >= 1:2.7
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
 Traitlets is a framework that lets Python classes have attributes with
-type checking, dynamically calculated default values, and ‘on change’
+type checking, dynamically calculated default values, and "on change"
 callbacks.
 
 %description -l pl.UTF-8
-System konfiguracji dla aplikacji w Pythonie.
+Traitlets to szkielet pozwalający klasom Pythona na trzymanie
+atrybutów ze sprawdzaniem typów, dynamicznie wyliczanymi wartościami
+domyślnymi oraz wywołaniami wstecznym "przy zmianie".
 
 %package -n python3-%{module}
-Summary:	-
-Summary(pl.UTF-8):	-
+Summary:	A configuration system for Python applications
+Summary(pl.UTF-8):	System konfiguracji dla aplikacji w Pythonie
 Group:		Libraries/Python
-Requires:	python3-decorator
-Requires:	python3-modules
+Requires:	python3-modules >= 1:3.3
 
 %description -n python3-%{module}
+Traitlets is a framework that lets Python classes have attributes with
+type checking, dynamically calculated default values, and "on change"
+callbacks.
 
 %description -n python3-%{module} -l pl.UTF-8
+Traitlets to szkielet pozwalający klasom Pythona na trzymanie
+atrybutów ze sprawdzaniem typów, dynamicznie wyliczanymi wartościami
+domyślnymi oraz wywołaniami wstecznym "przy zmianie".
 
 %package apidocs
 Summary:	%{module} API documentation
@@ -72,22 +92,28 @@ Dokumentacja API %{module}.
 
 %prep
 %setup -q -n %{module}-%{version}
-
-#%{__sed} -i -e '1s,^#!.*python,#!%{__python},' %{name}.py
+%patch0 -p1
 
 %build
 %if %{with python2}
-%py_build %{?with_tests:test}
+%py_build
+
+%if %{with tests}
+%{__python} -m pytest traitlets
+%endif
 %endif
 
 %if %{with python3}
-%py3_build %{?with_tests:test}
+%py3_build
+
+%if %{with tests}
+%{__python3} -m pytest traitlets
+%endif
 %endif
 
 %if %{with doc}
-cd docs
-%{__make} -j1 html
-rm -rf _build/html/_sources
+%{__make} -C docs html \
+	SPHINXBUILD=sphinx-build-3
 %endif
 
 %install
@@ -96,28 +122,17 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python2}
 %py_install
 
-%py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
-%py_comp $RPM_BUILD_ROOT%{py_sitedir}
-
 %py_postclean
+
+install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}
+cp -p examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}
 %endif
 
 %if %{with python3}
 %py3_install
-%endif
 
-# in case there are examples provided
-%if %{with python2}
-install -d $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}
-cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version}
-find $RPM_BUILD_ROOT%{_examplesdir}/python-%{module}-%{version} -name '*.py' \
-	| xargs sed -i '1s|^#!.*python\b|#!%{__python}|'
-%endif
-%if %{with python3}
 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
-cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
-find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
-	| xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
+cp -p examples/*.py $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
 %endif
 
 %clean
@@ -126,23 +141,23 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python2}
 %files
 %defattr(644,root,root,755)
-%doc README.md
-%{py_sitescriptdir}/%{module}
-%{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
+%doc COPYING.md README.md
+%{py_sitescriptdir}/traitlets
+%{py_sitescriptdir}/traitlets-%{version}-py*.egg-info
 %{_examplesdir}/python-%{module}-%{version}
 %endif
 
 %if %{with python3}
 %files -n python3-%{module}
 %defattr(644,root,root,755)
-%doc README.md
-%{py3_sitescriptdir}/%{module}
-%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
+%doc COPYING.md README.md
+%{py3_sitescriptdir}/traitlets
+%{py3_sitescriptdir}/traitlets-%{version}-py*.egg-info
 %{_examplesdir}/python3-%{module}-%{version}
 %endif
 
 %if %{with doc}
 %files apidocs
 %defattr(644,root,root,755)
-%doc docs/_build/html/*
+%doc docs/build/html/{_static,*.html,*.js}
 %endif
diff --git a/python-traitlets-use-setuptools.patch b/python-traitlets-use-setuptools.patch
new file mode 100644
index 0000000..f02ccd0
--- /dev/null
+++ b/python-traitlets-use-setuptools.patch
@@ -0,0 +1,11 @@
+--- traitlets-4.3.2/setup.py.orig	2017-02-23 11:21:19.000000000 +0100
++++ traitlets-4.3.2/setup.py	2019-09-21 18:16:38.636798015 +0200
+@@ -73,7 +73,7 @@
+     ],
+ )
+ 
+-if 'develop' in sys.argv or any(a.startswith('bdist') for a in sys.argv):
++if True:
+     import setuptools
+ 
+ setuptools_args = {}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-traitlets.git/commitdiff/b460cd269f2fd732a17d974c961355304bc9adee



More information about the pld-cvs-commit mailing list