]>
Commit | Line | Data |
---|---|---|
db818afa JK |
1 | # |
2 | # Conditional build: | |
3 | %bcond_with tests # do perform tests (broken in 4.2.15) | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
7 | %define module isort | |
8 | Summary: Python utility / library to sort imports alphabetically | |
9 | Name: python-%{module} | |
10 | Version: 4.2.15 | |
11 | Release: 1 | |
12 | License: MIT | |
13 | Group: Libraries/Python | |
14 | Source0: https://files.pythonhosted.org/packages/source/i/%{module}/%{module}-%{version}.tar.gz | |
15 | # Source0-md5: 34915a2ce60e6fe3dbcbf5982deef9b4 | |
16 | URL: https://github.com/timothycrosley/isort | |
17 | BuildRequires: rpm-pythonprov | |
18 | BuildRequires: rpmbuild(macros) >= 1.714 | |
19 | %if %{with python2} | |
20 | BuildRequires: python-setuptools | |
21 | %endif | |
22 | %if %{with python3} | |
23 | BuildRequires: python3-setuptools | |
24 | %endif | |
25 | Requires: python-modules | |
26 | BuildArch: noarch | |
27 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
28 | ||
29 | %description | |
30 | isort is a Python utility / library to sort imports alphabetically, | |
31 | and automatically separated into sections. It provides a command line | |
32 | utility, Python library and plugins for various editors to quickly | |
33 | sort all your imports. It currently cleanly supports Python 2.7 - 3.6 | |
34 | without any dependencies. | |
35 | ||
36 | %package -n python3-%{module} | |
37 | Summary: Python utility / library to sort imports alphabetically | |
38 | Group: Libraries/Python | |
39 | Requires: python3-modules | |
40 | ||
41 | %description -n python3-%{module} | |
42 | isort is a Python utility / library to sort imports alphabetically, | |
43 | and automatically separated into sections. It provides a command line | |
44 | utility, Python library and plugins for various editors to quickly | |
45 | sort all your imports. It currently cleanly supports Python 2.7 - 3.6 | |
46 | without any dependencies. | |
47 | ||
48 | %package -n isort | |
49 | Summary: Python utility / library to sort imports alphabetically | |
50 | Group: Development/Tools | |
51 | %if %{with python3} | |
52 | Requires: python3-%{module} = %{version}-%{release} | |
53 | %else | |
54 | Requires: python-%{module} = %{version}-%{release} | |
55 | %endif | |
56 | ||
57 | %description -n isort | |
58 | isort is a Python utility / library to sort imports alphabetically, | |
59 | and automatically separated into sections. It provides a command line | |
60 | utility, Python library and plugins for various editors to quickly | |
61 | sort all your imports. It currently cleanly supports Python 2.7 - 3.6 | |
62 | without any dependencies. | |
63 | ||
64 | %prep | |
65 | %setup -q -n %{module}-%{version} | |
66 | ||
67 | %build | |
68 | %if %{with python2} | |
69 | %py_build %{?with_tests:test} | |
70 | %endif | |
71 | ||
72 | %if %{with python3} | |
73 | %py3_build %{?with_tests:test} | |
74 | %endif | |
75 | ||
76 | %install | |
77 | rm -rf $RPM_BUILD_ROOT | |
78 | ||
79 | %if %{with python2} | |
80 | %py_install | |
81 | ||
db818afa JK |
82 | %py_postclean |
83 | %endif | |
84 | ||
85 | %if %{with python3} | |
86 | %py3_install | |
87 | %endif | |
88 | ||
89 | %clean | |
90 | rm -rf $RPM_BUILD_ROOT | |
91 | ||
92 | %if %{with python2} | |
93 | %files | |
94 | %defattr(644,root,root,755) | |
95 | %doc ACKNOWLEDGEMENTS.md CHANGELOG.md README.rst | |
96 | %{py_sitescriptdir}/%{module} | |
97 | %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
98 | %endif | |
99 | ||
100 | %if %{with python3} | |
101 | %files -n python3-%{module} | |
102 | %defattr(644,root,root,755) | |
103 | %doc ACKNOWLEDGEMENTS.md CHANGELOG.md README.rst | |
104 | %{py3_sitescriptdir}/%{module} | |
105 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
106 | %endif | |
107 | ||
108 | %files -n isort | |
109 | %defattr(644,root,root,755) | |
110 | %attr(755,root,root) %{_bindir}/isort |