python-gflags/python-gflags.spec
2020-01-10 23:40:05 -05:00

93 lines
2.9 KiB
RPMSpec

Name: python-gflags
Version: 2.0
Release: 16
Summary: Python commandline flags module
License: BSD
URL: https://github.com/google/python-gflags
Source0: https://github.com/google/python-gflags/archive/python-gflags-2.0.tar.gz
BuildArch: noarch
%description
The python-gflags package contains a library that implements commandline flags
processing. 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 for
a Python app.
%package -n python2-gflags
Summary: Python2 commandline flags module
BuildRequires: python2-devel python2-setuptools
%{?python_provide:%python_provide python2-gflags}
%description -n python2-gflags
The python-gflags package contains a library that implements commandline flags
processing. 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 for
a Python app.
%package -n python3-gflags
Summary: Python3 commandline flags module
BuildRequires: python3-devel python3-setuptools python3-tools
%{?python_provide:%python_provide python3-gflags}
%description -n python3-gflags
The python-gflags package contains a library that implements commandline flags
processing. 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 for
a Python app.
%prep
%setup -q -c
mv python-gflags-python-gflags-2.0 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
cd python2
python2 setup.py build
cd ../python3
python3 setup.py build
%install
cd python3
python3 setup.py install --skip-build --root %{buildroot}
mv %{buildroot}%{_bindir}/gflags2man.py %{buildroot}%{_bindir}/gflags2man-3
chmod +x %{buildroot}%{_bindir}/gflags2man-3
cd ../python2
python2 setup.py install --skip-build --root %{buildroot}
mv %{buildroot}%{_bindir}/gflags2man.py %{buildroot}%{_bindir}/gflags2man
chmod +x %{buildroot}%{_bindir}/gflags2man
%check
cd python2
python2 setup.py test
cd ../python3
python3 setup.py test
%files -n python2-gflags
%license python2/COPYING
%doc python2/AUTHORS python2/ChangeLog python2/COPYING python2/README
%{_bindir}/gflags2man
%{python2_sitelib}/gflags*.py*
%{python2_sitelib}/python_gflags-%{version}-*egg-info
%files -n python3-gflags
%license python3/COPYING
%doc python3/AUTHORS python3/ChangeLog python3/COPYING python3/README
%{_bindir}/gflags2man-3
%{python3_sitelib}/gflags*.py*
%{python3_sitelib}/python_gflags-%{version}-*egg-info
%{python3_sitelib}/__pycache__/*
%changelog
* Thu Jan 8 2020 yanzhihua <yanzhihua4@huawei.com> - 2.0-16
- Package init