diff --git a/1799.patch b/1799.patch new file mode 100644 index 0000000..220656e --- /dev/null +++ b/1799.patch @@ -0,0 +1,31 @@ +From f6bb2b93a09f7bd36ca06778d142fd39a02fa6fe Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Mon, 11 Jan 2021 13:42:43 +0100 +Subject: [PATCH] Allow building with setuptools_scm 4 and 5 + +--- + docs/changelog/1799.misc.rst | 1 + + pyproject.toml | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + create mode 100644 docs/changelog/1799.misc.rst + +diff --git a/docs/changelog/1799.misc.rst b/docs/changelog/1799.misc.rst +new file mode 100644 +index 000000000..640a93124 +--- /dev/null ++++ b/docs/changelog/1799.misc.rst +@@ -0,0 +1 @@ ++Enable building tox with ``setuptools_scm`` 4 and 5 by :user:hroncok +diff --git a/pyproject.toml b/pyproject.toml +index 93f95d62c..a57d6c9f6 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -1,7 +1,7 @@ + [build-system] + requires = [ + "setuptools >= 40.0.4", +- "setuptools_scm >= 2.0.0, <4", ++ "setuptools_scm >= 2.0.0, <6", + "wheel >= 0.29.0", + ] + build-backend = 'setuptools.build_meta' diff --git a/python-tox.spec b/python-tox.spec index 8a4c5d2..9c717f0 100644 --- a/python-tox.spec +++ b/python-tox.spec @@ -7,24 +7,40 @@ # 2) Install the built package # (e.g. mock install ./results_python-tox/.../python3-tox-...rpm) # 3) Build again --with tests (and internet connection) -# (e.g. fedpkg mockbuild --enable-network --no-clean-all) +# (e.g. fedpkg mockbuild --enable-network --no-clean-all --with tests) # The Fedora CI tests do this. %bcond_with tests - -%global pypi_name tox -Name: python-%{pypi_name} +Name: python-tox Version: 3.21.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Virtualenv-based automation of test activities License: MIT URL: https://tox.readthedocs.io/ -Source0: %{pypi_source} +Source0: %{pypi_source tox} + +# Allow building with setuptools_scm 4 and 5 +Patch1: https://github.com/tox-dev/tox/pull/1799.patch BuildArch: noarch -%description +BuildRequires: python3-devel +BuildRequires: pyproject-rpm-macros + +%if %{with tests} +BuildRequires: /usr/bin/gcc +BuildRequires: /usr/bin/git +BuildRequires: /usr/bin/pip +BuildRequires: /usr/bin/poetry +BuildRequires: /usr/bin/pytest +BuildRequires: /usr/bin/python +BuildRequires: libffi-devel +# The tests only work if the tested tox is installed :( +BuildRequires: tox = %{version}-%{release} +%endif + +%global _description %{expand: Tox as is a generic virtualenv management and test command line tool you can use for: @@ -33,16 +49,13 @@ can use for: - running your tests in each of the environments, configuring your test tool of choice - acting as a frontend to Continuous Integration servers, greatly reducing - boilerplate and merging CI and shell-based testing. + boilerplate and merging CI and shell-based testing.} + +%description %_description -%package -n python3-%{pypi_name} +%package -n tox Summary: %{summary} -%{?python_provide:%python_provide python3-%{pypi_name}} -Provides: %{pypi_name} = %{version}-%{release} -BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-setuptools_scm # Recommend "all the Pythons" # Why? Tox exists to enable developers to test libraries against various Python @@ -63,83 +76,49 @@ Recommends: pypy3-devel Recommends: python2-devel Recommends: python3-devel -# Replace the python2 version -Obsoletes: python2-tox < 2.9.1-4 - # Replace detox (no longer supported, functionality is now in tox) +# Remove this once Fedora 32 goes EOL Obsoletes: python3-detox < 0.19-5 -%if %{with tests} -BuildRequires: python3-filelock -BuildRequires: python3-flaky -BuildRequires: python3-freezegun -BuildRequires: python3-packaging -BuildRequires: python3-pip -BuildRequires: python3-pluggy >= 0.12 -BuildRequires: python3-poetry -BuildRequires: python3-psutil -BuildRequires: python3-py -BuildRequires: python3-pytest -BuildRequires: python3-pytest-mock -BuildRequires: python3-pytest-randomly -BuildRequires: python3-pytest-xdist -BuildRequires: python3-toml -BuildRequires: python3-virtualenv -BuildRequires: python3-wheel -BuildRequires: (python3-importlib-metadata if python3 < 3.8) -BuildRequires: /usr/bin/gcc -BuildRequires: /usr/bin/git -BuildRequires: /usr/bin/pip -BuildRequires: /usr/bin/poetry -BuildRequires: /usr/bin/pytest -BuildRequires: /usr/bin/python -BuildRequires: libffi-devel -# The tests only work if the tested tox is installed :( -BuildRequires: %{pypi_name} = %{version}-%{release} -%endif - -%?python_enable_dependency_generator +%py_provides python3-tox +# Remove this once Fedora 36 goes EOL: +Obsoletes: python3-tox < 3.21.0-2 -%description -n python3-%{pypi_name} -Tox as is a generic virtualenv management and test command line tool you -can use for: +%description -n tox %_description - - checking your package installs correctly with different Python versions - and interpreters - - running your tests in each of the environments, configuring your test tool - of choice - - acting as a frontend to Continuous Integration servers, greatly reducing - boilerplate and merging CI and shell-based testing. %prep -%autosetup -p1 -n %{pypi_name}-%{version} +%autosetup -p1 -n tox-%{version} -# Pathlib2 was retired in Fedora, instead of unretiring it, -# it's enough to use pathlib instead. -find . -type f -name "*.py" -print0 | xargs -0 sed -i "s/pathlib2/pathlib/g" -# remove bundled egg-info -rm -rf %{pypi_name}.egg-info +%generate_buildrequires +%pyproject_buildrequires %{?with_tests:-x testing} + %build -%py3_build +%pyproject_wheel %install -%py3_install +%pyproject_install +%pyproject_save_files tox + %if %{with tests} %check %pytest -n auto %endif -%files -n python3-%{pypi_name} -%{_bindir}/%{pypi_name} -%{_bindir}/%{pypi_name}-quickstart -%{python3_sitelib}/%{pypi_name}/ -%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info/ + +%files -n tox -f %{pyproject_files} +%{_bindir}/tox +%{_bindir}/tox-quickstart + %changelog +* Fri Jan 08 2021 Miro Hrončok - 3.21.0-2 +- Rename the installable package to "tox" + * Fri Jan 08 2021 Miro Hrončok - 3.21.0-1 - Update to 3.21.0 diff --git a/tests/tests.yml b/tests/tests.yml index cacaad9..90cf3b8 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -24,9 +24,9 @@ - repo: "https://src.fedoraproject.org/rpms/pyproject-rpm-macros.git" dest: "pyproject-rpm-macros" tests: - - rpmbuild: + - mock_with_tests: dir: . - run: "dnf -y build-dep --define '_with_tests 1' {{ tenv_workdir }}/python-tox.spec && rpmbuild --define '_sourcedir {{ tenv_workdir }}' --with tests -ba {{ tenv_workdir }}/python-tox.spec" + run: pyproject-rpm-macros/tests/mocktest.sh python-tox --enable-network --with tests - smoke27: dir: python/smoke run: VERSION=2.7 METHOD=virtualenv ./venv.sh