orion pushed to python-gflags (f22). "Create python3 package (bug #1209201)"

notifications at fedoraproject.org notifications at fedoraproject.org
Mon Apr 6 18:50:28 UTC 2015


>From f59140a7d1be6e800ddec02ef095965c55823271 Mon Sep 17 00:00:00 2001
From: Orion Poplawski <orion at cora.nwra.com>
Date: Mon, 6 Apr 2015 12:48:46 -0600
Subject: Create python3 package (bug #1209201)


diff --git a/python-gflags.spec b/python-gflags.spec
index e2a71b8..00e45a4 100644
--- a/python-gflags.spec
+++ b/python-gflags.spec
@@ -2,7 +2,7 @@
 
 Name:           python-%{upstream_name}
 Version:        2.0
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Commandline flags module for Python
 
 Group:          Development/Languages
@@ -12,7 +12,7 @@ Source0:        http://python-gflags.googlecode.com/files/python-gflags-%{versio
 
 BuildArch:      noarch
 BuildRequires:  python-devel
-BuildRequires:  python-distribute
+BuildRequires:  python-setuptools
 
 %description
 This project is the python equivalent of google-gflags, a Google commandline
@@ -27,31 +27,91 @@ flexibility, including built-in support for Python types, and the ability to
 define flags in the source file in which they're used. (This last is its major
 difference from OptParse.)
 
+%package -n python3-%{upstream_name}
+Summary:        Commandline flags module for Python 3
+BuildRequires:  python3-devel
+BuildRequires:  python3-setuptools
+BuildRequires:  python-tools
+
+%description -n python3-%{upstream_name}
+This project is the python equivalent of google-gflags, a Google commandline
+flag implementation for C++. It is intended to be used in situations where a
+project wants to mimic the command-line flag handling of a C++ app that uses
+google-gflags, or for a Python app that, via swig or some other means, is
+linked with a C++ app that uses google-gflags.
+
+The gflags package contains a library that implements commandline flags
+processing. As such it's a replacement for getopt(). It has increased
+flexibility, including built-in support for Python types, and the ability to
+define flags in the source file in which they're used. (This last is its major
+difference from OptParse.)
+
+
 %prep
-%setup -q
-# Fix non-executable-script error
-sed -i '/^#!\/usr\/bin\/env python$/,+1 d' %{upstream_name}.py
+%setup -qc
+mv %{name}-%{version} python2
+sed -i '1s|^#!/usr/bin/env python$|#!%{__python2}|' python2/gflags2man.py
+sed -i '/^#!\/usr\/bin\/env python$/,+1 d' python2/gflags*.py
+cp -a python2 python3
+sed -i '1s|^#!%{__python2}$|#!%{__python3}|' python3/gflags2man.py
+2to3 --write --nobackup python3
+
 
 %build
+pushd python2
 %{__python2} setup.py build
+popd
+pushd python3
+%{__python3} setup.py build
+popd
 
-%install
-%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
 
-# Remove ext from name
+%install
+pushd python3
+%{__python3} setup.py install --skip-build --root %{buildroot}
+mv %{buildroot}%{_bindir}/gflags2man.py  %{buildroot}%{_bindir}/gflags2man-3
+chmod +x %{buildroot}%{_bindir}/gflags2man-3
+popd
+
+pushd python2
+%{__python2} setup.py install --skip-build --root %{buildroot}
 mv %{buildroot}%{_bindir}/gflags2man.py  %{buildroot}%{_bindir}/gflags2man
+chmod +x %{buildroot}%{_bindir}/gflags2man
+popd
+
 
 %check
+pushd python2
 %{__python2} setup.py test
+popd
+
+pushd python3
+%{__python3} setup.py test
+popd
+
 
 %files
-%doc AUTHORS ChangeLog COPYING README
-%{python_sitelib}/%{upstream_name}.py*
-%{python_sitelib}/%{upstream_name}_validators.py*
-%{python_sitelib}/python_gflags-%{version}-*egg-info
+%license python2/COPYING
+%doc python2/AUTHORS python2/ChangeLog python2/COPYING python2/README
+%{python2_sitelib}/%{upstream_name}.py*
+%{python2_sitelib}/%{upstream_name}_validators.py*
+%{python2_sitelib}/python_gflags-%{version}-*egg-info
 %{_bindir}/gflags2man
 
+%files -n python3-%{upstream_name}
+%license python3/COPYING
+%doc python3/AUTHORS python3/ChangeLog python3/COPYING python3/README
+%{python3_sitelib}/%{upstream_name}.py*
+%{python3_sitelib}/%{upstream_name}_validators.py*
+%{python3_sitelib}/python_gflags-%{version}-*egg-info
+%{python3_sitelib}/__pycache__/*
+%{_bindir}/gflags2man-3
+
+
 %changelog
+* Mon Apr 6 2015 Orion Poplawski <orion at cora.nwra.com> - 2.0-2
+- Create python3 package (bug #1209201)
+
 * Mon Apr 6 2015 Orion Poplawski <orion at cora.nwra.com> - 2.0-1
 - Update to 2.0
 
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/python-gflags.git/commit/?h=f22&id=f59140a7d1be6e800ddec02ef095965c55823271


More information about the scm-commits mailing list