391798f
%if (! 0%{?rhel}) || 0%{?rhel} > 6
391798f
%global with_python3 1
391798f
%global python3_version %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3])")
391798f
%endif
391798f
%if 0%{?rhel} && 0%{?rhel} < 6
391798f
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
391798f
%endif
391798f
391798f
391798f
Name:           pycmd
391798f
Version:        1.0
3346eca
Release:        6%{?dist}
391798f
Summary:        Tools for managing/searching Python related files
391798f
Group:          Development/Languages
391798f
License:        MIT
391798f
URL:            http://pypi.python.org/pypi/pycmd
391798f
Source0:        http://pypi.python.org/packages/source/p/%{name}/%{name}-%{version}.zip
391798f
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
391798f
BuildArch:      noarch
391798f
BuildRequires:  python-devel
812ff7d
BuildRequires:  python-setuptools
812ff7d
Requires:       python-setuptools
812ff7d
BuildRequires:  python-py >= 1.4.0
391798f
Requires:       python-py >= 1.4.0
391798f
%if 0%{?with_python3}
391798f
BuildRequires:  python3-devel
812ff7d
BuildRequires:  python3-setuptools
391798f
BuildRequires:  python3-py >= 1.4.0
391798f
%endif # with_python3
391798f
# pycmd was separated from pylib at that point
391798f
Conflicts:      python-py < 1.4.0
391798f
391798f
391798f
%description
391798f
Pycmd is a collection of command line tools for helping with Python
391798f
development.
391798f
391798f
%if 0%{?with_python3}
391798f
%package -n python3-pycmd
391798f
Summary:        Tools for managing/searching Python related files
391798f
Group:          Development/Languages
f961c9b
Requires:       python3-setuptools
f961c9b
Requires:       python3-py >= 1.4.0
391798f
391798f
391798f
%description -n python3-pycmd
391798f
Pycmd is a collection of command line tools for helping with Python
391798f
development.
391798f
%endif # with_python3
391798f
391798f
391798f
%prep
391798f
%setup -q
391798f
391798f
%if 0%{?with_python3}
391798f
cp -a . %{py3dir}
391798f
%endif # with_python3
391798f
391798f
391798f
%build
391798f
%{__python} setup.py build
391798f
391798f
%if 0%{?with_python3}
391798f
pushd %{py3dir}
391798f
%{__python3} setup.py build
391798f
popd
391798f
%endif # with_python3
391798f
391798f
391798f
%install
391798f
rm -rf %{buildroot}
391798f
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
391798f
391798f
# remove shebangs
391798f
find %{buildroot}%{python_sitelib} -name '*.py' \
391798f
     -exec sed -i -e '1{/^#!/d}' {} \;
391798f
391798f
# rename binaries
391798f
pushd %{buildroot}%{_bindir}
391798f
for cmd in py.cleanup py.convert_unittest py.countloc py.lookup py.svnwcrevert py.which; do
391798f
  mv ${cmd} ${cmd}-%{python_version}
391798f
done
391798f
popd
391798f
391798f
%if 0%{?with_python3}
391798f
pushd %{py3dir}
391798f
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
391798f
391798f
# remove shebangs from all scripts
391798f
find %{buildroot}%{python3_sitelib} -name '*.py' \
391798f
     -exec sed -i -e '1{/^#!/d}' {} \;
391798f
391798f
# rename binaries
391798f
pushd %{buildroot}%{_bindir}
391798f
for cmd in py.cleanup py.convert_unittest py.countloc py.lookup py.svnwcrevert py.which; do
391798f
  mv ${cmd} ${cmd}-%{python3_version}
391798f
done
391798f
popd
391798f
391798f
popd
391798f
%endif # with_python3
391798f
391798f
# 2.X binaries are called by default for now
391798f
pushd %{buildroot}%{_bindir}
391798f
for cmd in py.cleanup py.convert_unittest py.countloc py.lookup py.svnwcrevert py.which; do
391798f
  ln -s ${cmd}-%{python_version} ${cmd}
391798f
done
391798f
391798f
391798f
%clean
391798f
rm -rf %{buildroot}
391798f
391798f
391798f
%files
391798f
%defattr(-,root,root,-)
391798f
%doc LICENSE README.txt CHANGELOG
391798f
%{_bindir}/py.cleanup
391798f
%{_bindir}/py.cleanup-%{python_version}
391798f
%{_bindir}/py.convert_unittest
391798f
%{_bindir}/py.convert_unittest-%{python_version}
391798f
%{_bindir}/py.countloc
391798f
%{_bindir}/py.countloc-%{python_version}
391798f
%{_bindir}/py.lookup
391798f
%{_bindir}/py.lookup-%{python_version}
391798f
%{_bindir}/py.svnwcrevert
391798f
%{_bindir}/py.svnwcrevert-%{python_version}
391798f
%{_bindir}/py.which
391798f
%{_bindir}/py.which-%{python_version}
391798f
%{python_sitelib}/*
391798f
391798f
%if 0%{?with_python3}
391798f
%files -n python3-pycmd
391798f
%defattr(-,root,root,-)
391798f
%doc LICENSE README.txt CHANGELOG
391798f
%{_bindir}/py.cleanup-%{python3_version}
391798f
%{_bindir}/py.convert_unittest-%{python3_version}
391798f
%{_bindir}/py.countloc-%{python3_version}
391798f
%{_bindir}/py.lookup-%{python3_version}
391798f
%{_bindir}/py.svnwcrevert-%{python3_version}
391798f
%{_bindir}/py.which-%{python3_version}
391798f
%{python3_sitelib}/*
391798f
%endif # with_python3
391798f
391798f
391798f
%changelog
3346eca
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-6
3346eca
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
3346eca
e0236e6
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0-5
e0236e6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
e0236e6
f961c9b
* Sat Sep  3 2011 Thomas Moschny <thomas.moschny@gmx.de> - 1.0-4
f961c9b
- Fix: python3 dependencies.
f961c9b
812ff7d
* Thu Aug 11 2011 Thomas Moschny <thomas.moschny@gmx.de> - 1.0-3
812ff7d
- Update Requires and BuildRequires tags.
812ff7d
391798f
* Tue Jul  5 2011 Thomas Moschny <thomas.moschny@gmx.de> - 1.0-2
391798f
- Python3 subpackage.
391798f
391798f
* Sun Jan 16 2011 Thomas Moschny <thomas.moschny@gmx.de> - 1.0-1
391798f
- New package.