[packages/python-docopt] - new
baggins
baggins at pld-linux.org
Fri Jul 4 21:44:29 CEST 2014
commit d0fc539f61fc188815c7d7a4a36f946331353bc6
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Fri Jul 4 21:44:18 2014 +0200
- new
python-docopt.spec | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 113 insertions(+)
---
diff --git a/python-docopt.spec b/python-docopt.spec
new file mode 100644
index 0000000..bc6e56e
--- /dev/null
+++ b/python-docopt.spec
@@ -0,0 +1,113 @@
+#
+# Conditional build:
+%bcond_without tests # do not perform "make test"
+%bcond_without python2 # CPython 2.x module
+%bcond_without python3 # CPython 3.x module
+
+%define module docopt
+Summary: Pythonic argument parser, that will make you smile
+Name: python-%{module}
+Version: 0.6.2
+Release: 1
+License: MIT
+Group: Libraries/Python
+Source0: https://pypi.python.org/packages/source/d/docopt/%{module}-%{version}.tar.gz
+# Source0-md5: 4bc74561b37fad5d3e7d037f82a4c3b1
+URL: http://docopt.org/
+BuildRequires: rpm-pythonprov
+# if py_postclean is used
+BuildRequires: rpmbuild(macros) >= 1.219
+# when using /usr/bin/env or other in-place substitutions
+#BuildRequires: sed >= 4.0
+%if %{with python2}
+BuildRequires: python-distribute
+%endif
+%if %{with python3}
+BuildRequires: python3-distribute
+BuildRequires: python3-modules
+%endif
+Requires: python-modules
+BuildArch: noarch
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+docopt creates beautiful command-line interfaces.
+
+%package -n python3-%{module}
+Summary: Pythonic argument parser, that will make you smile
+Group: Libraries/Python
+
+%description -n python3-%{module}
+docopt creates beautiful command-line interfaces.
+
+%prep
+%setup -q -n %{module}-%{version}
+
+# fix #!/usr/bin/env python -> #!/usr/bin/python:
+#%{__sed} -i -e '1s,^#!.*python,#!%{__python},' %{name}.py
+
+%build
+%if %{with python2}
+%{__python} setup.py build --build-base build-2 %{?with_tests:test}
+%endif
+
+%if %{with python3}
+%{__python3} setup.py build --build-base build-3 %{?with_tests:test}
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%{__python} setup.py \
+ build --build-base build-2 \
+ install --skip-build \
+ --optimize=2 \
+ --root=$RPM_BUILD_ROOT
+
+%py_postclean
+%endif
+
+%if %{with python3}
+%{__python3} setup.py \
+ build --build-base build-3 \
+ install --skip-build \
+ --optimize=2 \
+ --root=$RPM_BUILD_ROOT
+%endif
+
+# in case there are examples provided
+%if %{with python2}
+install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+%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}|'
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%files
+%defattr(644,root,root,755)
+%doc README.rst
+%{py_sitescriptdir}/*.py[co]
+%if "%{py_ver}" > "2.4"
+%{py_sitescriptdir}/%{module}-*.egg-info
+%endif
+%{_examplesdir}/%{name}-%{version}
+%endif
+
+%if %{with python3}
+%files -n python3-%{module}
+%defattr(644,root,root,755)
+%doc README.rst
+%{py3_sitescriptdir}/__pycache__/*.py[co]
+%{py3_sitescriptdir}/%{module}.py
+%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
+%{_examplesdir}/python3-%{module}-%{version}
+%endif
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-docopt.git/commitdiff/d0fc539f61fc188815c7d7a4a36f946331353bc6
More information about the pld-cvs-commit
mailing list