# Note package contains no LICENSE/COPYING file. Reported upstream: # https://github.com/alecthomas/importmagic/issues/21 %{!?__python2: %global __python2 %__python} %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %if 0%{?fedora} %bcond_without python3 %else %bcond_with python3 %endif %global pypi_name importmagic Name: python-%{pypi_name} Version: 0.1.3 Release: 3%{?dist} Summary: Python library to auto-magically add, remove and manage imports License: BSD URL: http://github.com/alecthomas/importmagic Source0: https://pypi.python.org/packages/source/i/%{pypi_name}/%{pypi_name}-0.1.3.tar.gz # This file is needed for the tests. Pulled from upstream github # repository on 10/7/2015. Filed a request to include this file in the # release tarball: https://github.com/alecthomas/importmagic/issues/22 Source1: test_index.json BuildArch: noarch Requires: python-six BuildRequires: python2-devel BuildRequires: python-setuptools BuildRequires: python-six %if %{with python3} BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-six %endif # with python3 %description The goal of this package is to be able to automatically manage imports in Python. To that end it can: o Build an index of all known symbols in all packages. o Find unresolved references in source, and resolve them against the index, effectively automating imports. o Automatically arrange imports according to PEP8. It was originally written for the Sublime Text 2 Python Import Magic plugin. %if %{with python3} %package -n python3-%{pypi_name} Summary: Python library to auto-magically add, remove and manage imports Requires: python3-six %description -n python3-%{pypi_name} The goal of this package is to be able to automatically manage imports in Python. To that end it can: o Build an index of all known symbols in all packages. o Find unresolved references in source, and resolve them against the index, effectively automating imports. o Automatically arrange imports according to PEP8. It was originally written for the Sublime Text 2 Python Import Magic plugin. %endif # with python3 %prep %setup -qc mv %{pypi_name}-%{version} python2 cp %SOURCE1 python2/%{pypi_name} rm -rf python2/%{pypi_name}.egg-info # Unbundle six.py # https://github.com/alecthomas/importmagic/issues/23 pushd python2/%{pypi_name} rm -f six.py for i in *.py ; do sed -i -e 's/importmagic.six/six/g' ${i} done popd cp python2/README.md . cp python2/CHANGES . %if %{with python3} cp -a python2 python3 %endif # with python3 %build pushd python2 %{__python2} setup.py build popd %if %{with python3} pushd python3 %{__python3} setup.py build popd %endif # with python3 %install %if %{with python3} pushd python3 %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd %endif # with python3 pushd python2 %{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd %check pushd python2 %{__python2} setup.py test popd %if %{with python3} pushd python3 %{__python3} setup.py test popd %endif %files %doc README.md CHANGES %{python2_sitelib}/%{pypi_name} %{python2_sitelib}/%{pypi_name}*.egg-info %if %{with python3} %files -n python3-%{pypi_name} %doc README.md CHANGES %{python3_sitelib}/%{pypi_name} %{python3_sitelib}/%{pypi_name}*.egg-info %endif # with python3 %changelog * Sun Jul 12 2015 Jonathan Underwood - 0.1.3-3 - Fix typo in %%check - Remove macro from URL - Unbundle python-six files - Require and BuildRequire (for %%check) python[3]-six - Remove tabs from spec file * Sat Jul 11 2015 Jonathan Underwood - 0.1.3-2 - Add BuildRequires for python-setuptools and python3-setuptools * Fri Jul 10 2015 Jonathan Underwood - 0.1.3-1 - Initial package