2017-03-15 15:17:36 +00:00
|
|
|
|
#
|
|
|
|
|
# spec file for package python-isort
|
|
|
|
|
#
|
2020-03-14 08:32:33 +00:00
|
|
|
|
# Copyright (c) 2020 SUSE LLC
|
2017-03-15 15:17:36 +00:00
|
|
|
|
#
|
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
|
2019-02-14 21:12:20 +00:00
|
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
2017-03-15 15:17:36 +00:00
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
2019-03-01 14:47:56 +00:00
|
|
|
|
%global flavor @BUILD_FLAVOR@%{nil}
|
|
|
|
|
%if "%{flavor}" == "test"
|
|
|
|
|
%define psuffix -test
|
|
|
|
|
%bcond_without test
|
|
|
|
|
%else
|
|
|
|
|
%define psuffix %{nil}
|
|
|
|
|
%bcond_with test
|
|
|
|
|
%endif
|
2020-07-13 19:54:31 +00:00
|
|
|
|
%define skip_python2 1
|
2019-03-04 11:05:46 +00:00
|
|
|
|
Name: python-isort%{psuffix}
|
2020-10-08 16:56:36 +00:00
|
|
|
|
Version: 5.6.1
|
2017-03-15 15:17:36 +00:00
|
|
|
|
Release: 0
|
|
|
|
|
Summary: A Python utility / library to sort Python imports
|
|
|
|
|
License: MIT
|
2020-09-08 12:27:21 +00:00
|
|
|
|
URL: https://pycqa.github.io/isort/
|
2020-10-08 16:56:36 +00:00
|
|
|
|
# Data for tests are not packaged for PyPI, get them from Github
|
|
|
|
|
Source: https://github.com/PyCQA/isort/archive/%{version}.tar.gz#/isort-%{version}-gh.tar.gz
|
|
|
|
|
BuildRequires: %{python_module pip}
|
|
|
|
|
BuildRequires: %{python_module poetry}
|
2019-03-29 09:42:00 +00:00
|
|
|
|
BuildRequires: fdupes
|
|
|
|
|
BuildRequires: python-rpm-macros
|
|
|
|
|
Requires: python-setuptools
|
2020-05-25 13:31:50 +00:00
|
|
|
|
Requires(post): update-alternatives
|
|
|
|
|
Requires(postun): update-alternatives
|
2020-10-08 16:56:36 +00:00
|
|
|
|
Recommends: python-colorama >= 0.4.3
|
2020-08-27 11:17:00 +00:00
|
|
|
|
Recommends: python-hypothesmith
|
2020-07-13 19:54:31 +00:00
|
|
|
|
Recommends: python-pip-api
|
2019-03-29 09:42:00 +00:00
|
|
|
|
Recommends: python-pipreqs
|
2020-10-08 16:56:36 +00:00
|
|
|
|
Recommends: python-requirementslib
|
2020-07-28 20:21:49 +00:00
|
|
|
|
Suggests: git
|
2019-03-29 09:42:00 +00:00
|
|
|
|
BuildArch: noarch
|
2019-03-01 14:47:56 +00:00
|
|
|
|
%if %{with test}
|
2020-07-28 20:21:49 +00:00
|
|
|
|
BuildRequires: %{python_module black}
|
2020-07-13 19:54:31 +00:00
|
|
|
|
BuildRequires: %{python_module hypothesis-auto}
|
2020-08-27 11:17:00 +00:00
|
|
|
|
BuildRequires: %{python_module hypothesmith}
|
|
|
|
|
BuildRequires: %{python_module libcst}
|
2017-03-15 15:17:36 +00:00
|
|
|
|
BuildRequires: %{python_module mock}
|
2020-07-13 19:54:31 +00:00
|
|
|
|
BuildRequires: %{python_module pip-api}
|
2019-03-29 09:42:00 +00:00
|
|
|
|
BuildRequires: %{python_module pipreqs}
|
2019-02-28 08:57:44 +00:00
|
|
|
|
BuildRequires: %{python_module pylama}
|
2020-09-08 12:27:21 +00:00
|
|
|
|
BuildRequires: %{python_module pytest-mock}
|
2017-03-15 15:17:36 +00:00
|
|
|
|
BuildRequires: %{python_module pytest}
|
2020-10-08 16:56:36 +00:00
|
|
|
|
BuildRequires: %{python_module requirementslib >= 1.5}
|
2020-07-28 19:26:39 +00:00
|
|
|
|
BuildRequires: git
|
2018-02-02 20:53:14 +00:00
|
|
|
|
%endif
|
2017-03-15 15:17:36 +00:00
|
|
|
|
%python_subpackages
|
|
|
|
|
|
|
|
|
|
%description
|
|
|
|
|
isort your python imports for you so you don’t have to.
|
|
|
|
|
|
2020-07-13 19:54:31 +00:00
|
|
|
|
isort is a Python utility / library to sort imports alphabetically, and
|
|
|
|
|
automatically separated into sections and by type. It provides a command line
|
|
|
|
|
utility, Python library and plugins for various editors to quickly sort all your
|
|
|
|
|
imports. It requires Python 3.6+ to run but supports formatting Python 2 code
|
|
|
|
|
too.
|
2017-03-15 15:17:36 +00:00
|
|
|
|
|
|
|
|
|
%prep
|
|
|
|
|
%setup -q -n isort-%{version}
|
2017-03-24 17:02:57 +00:00
|
|
|
|
chmod -x LICENSE
|
2017-03-15 15:17:36 +00:00
|
|
|
|
|
|
|
|
|
%build
|
2020-10-08 16:56:36 +00:00
|
|
|
|
%pyproject_wheel
|
2017-03-15 15:17:36 +00:00
|
|
|
|
|
2020-10-08 16:56:36 +00:00
|
|
|
|
%if ! %{with test}
|
2017-03-15 15:17:36 +00:00
|
|
|
|
%install
|
2020-10-08 16:56:36 +00:00
|
|
|
|
%pyproject_install
|
2020-05-25 13:31:50 +00:00
|
|
|
|
%python_clone -a %{buildroot}%{_bindir}/isort
|
2019-02-28 08:57:44 +00:00
|
|
|
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
2019-03-01 14:47:56 +00:00
|
|
|
|
%endif
|
2017-03-15 15:17:36 +00:00
|
|
|
|
|
2019-03-01 14:47:56 +00:00
|
|
|
|
%if %{with test}
|
2020-07-13 19:54:31 +00:00
|
|
|
|
%check
|
2020-10-08 16:56:36 +00:00
|
|
|
|
ORIGPATH=$PATH
|
|
|
|
|
%{python_expand # install example projects for testing
|
|
|
|
|
mkdir isort-test-%{$python_bin_suffix}
|
|
|
|
|
for proj in isort*.whl example_shared_isort_profile example_isort_formatting_plugin; do
|
|
|
|
|
$python -m pip install --verbose \
|
|
|
|
|
--root $(pwd)/isort-test-%{$python_bin_suffix} \
|
|
|
|
|
--no-deps \
|
|
|
|
|
--use-pep517 \
|
|
|
|
|
--no-build-isolation \
|
|
|
|
|
--progress-bar off \
|
|
|
|
|
--disable-pip-version-check \
|
|
|
|
|
$proj
|
2020-07-28 20:21:49 +00:00
|
|
|
|
done
|
2020-10-08 16:56:36 +00:00
|
|
|
|
|
|
|
|
|
export PATH="$(pwd)/isort-test-%{$python_bin_suffix}/usr/bin:$ORIGPATH"
|
|
|
|
|
export PYTHONPATH="$(pwd)/isort-test-%{$python_bin_suffix}%{$python_sitelib}"
|
|
|
|
|
export PYTHONDONTWRITEBYTECODE=1
|
2020-09-08 12:27:21 +00:00
|
|
|
|
# test_projects_using_isort.py: these tests try to clone from
|
|
|
|
|
# online git repositories.
|
2020-09-08 14:15:58 +00:00
|
|
|
|
# test_settung_combinations.py::test_isort_is_idempotent
|
|
|
|
|
# is flaky https://github.com/PyCQA/isort/issues/1466
|
2020-10-08 16:56:36 +00:00
|
|
|
|
pytest-%{$python_bin_suffix} -v \
|
|
|
|
|
-W "ignore::UserWarning" \
|
2020-09-08 12:27:21 +00:00
|
|
|
|
-W "ignore::DeprecationWarning" \
|
2020-09-08 14:15:58 +00:00
|
|
|
|
--ignore tests/integration/test_projects_using_isort.py \
|
|
|
|
|
-k "not (test_setting_combinations and test_isort_is_idempotent)"
|
2020-09-08 12:27:21 +00:00
|
|
|
|
}
|
2019-03-01 14:47:56 +00:00
|
|
|
|
%endif
|
2017-03-15 15:17:36 +00:00
|
|
|
|
|
2020-10-08 16:56:36 +00:00
|
|
|
|
%if ! %{with test}
|
2020-05-25 13:31:50 +00:00
|
|
|
|
%post
|
|
|
|
|
%python_install_alternative isort
|
|
|
|
|
|
|
|
|
|
%postun
|
|
|
|
|
%python_uninstall_alternative isort
|
|
|
|
|
|
2017-03-15 15:17:36 +00:00
|
|
|
|
%files %{python_files}
|
2020-08-27 11:17:00 +00:00
|
|
|
|
%doc README.md
|
2017-06-23 17:12:16 +00:00
|
|
|
|
%license LICENSE
|
2020-07-13 19:54:31 +00:00
|
|
|
|
%python_alternative %{_bindir}/isort
|
|
|
|
|
%{python_sitelib}/isort
|
2020-10-08 16:56:36 +00:00
|
|
|
|
%{python_sitelib}/isort-%{version}.dist-info
|
2019-03-01 14:47:56 +00:00
|
|
|
|
%endif
|
2017-03-15 15:17:36 +00:00
|
|
|
|
|
|
|
|
|
%changelog
|