Compare commits

..

No commits in common. "345517d213b984053aa1b5f5393b96f3e848dfdc" and "5f5038f73e963bd4858a545ccc42958bcbb73f0a" have entirely different histories.

32 changed files with 82 additions and 331 deletions

View File

@ -288,12 +288,6 @@ However, in Fedora packages, always list executables explicitly to avoid uninten
and language (`*.mo`) files with `%lang` macro and appropriate language code.
Only license files declared via [PEP 639] `License-File` field are detected.
[PEP 639] is still a draft and can be changed in the future.
It is possible to use the `-l` flag to declare that a missing license should
terminate the build or `-L` (the default) to explicitly disable this check.
Packagers are encouraged to use the `-l` flag when the `%license` file is not manually listed in `%files`
to avoid accidentally losing the file in a future version.
When the `%license` file is manually listed in `%files`,
packagers can use the `-L` flag to ensure future compatibility in case the `-l` behavior eventually becomes a default.
Note that `%pyproject_save_files` uses data from the [RECORD file](https://www.python.org/dev/peps/pep-0627/).
If you wish to rename, remove or otherwise change the installed files of a package
@ -348,12 +342,6 @@ The `%pyproject_check_import` macro also accepts positional arguments with
additional qualified module names to check, useful for example if some modules are installed manually.
Note that filtering by `-t`/`-e` also applies to the positional arguments.
Another macro, `%_pyproject_check_import_allow_no_modules` allows to pass the import check,
even if no Python modules are detected in the package.
This may be a valid case for packages containing e.g. typing stubs.
Don't use this macro in Fedora packages.
It's only intended to be used in automated build environments such as Copr.
Generating Extras subpackages
-----------------------------

View File

@ -1,9 +1,5 @@
# This is a backward-compatible suffix used in all pyproject-rpm-macros directories
# For the main Python it's empty, for all others it's "-3.X"
%_pyproject_files_pkgversion %{expr:"%{python3_pkgversion}" != "3" ? "-%{python3_pkgversion}" : ""}
# This is a directory where wheels are stored and installed from, absolute
%_pyproject_wheeldir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/pyproject-wheeldir%{_pyproject_files_pkgversion}
%_pyproject_wheeldir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/pyproject-wheeldir
# This is a directory used as TMPDIR, where pip copies sources to and builds from, relative to PWD
# For proper debugsource packages, we create TMPDIR within PWD
@ -12,12 +8,12 @@
# This will be used in debugsource package paths (applies to extension modules only)
# NB: pytest collects tests from here if not hidden
# https://docs.pytest.org/en/latest/reference.html#confval-norecursedirs
%_pyproject_builddir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/.pyproject-builddir%{_pyproject_files_pkgversion}
%_pyproject_builddir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/.pyproject-builddir
# We prefix all created files with this value to make them unique
# Ideally, we would put them into %%{buildsubdir}, but that value changes during the spec
# The used value is similar to the one used to define the default %%buildroot
%_pyproject_files_prefix %{name}-%{version}-%{release}.%{_arch}%{_pyproject_files_pkgversion}
%_pyproject_files_prefix %{name}-%{version}-%{release}.%{_arch}
%pyproject_files %{_builddir}/%{_pyproject_files_prefix}-pyproject-files
%_pyproject_modules %{_builddir}/%{_pyproject_files_prefix}-pyproject-modules
@ -69,10 +65,6 @@ echo $(IFS=:; echo "${pyproject_build_lib[*]}")
%pyproject_install() %{expand:\\\
specifier=$(ls %{_pyproject_wheeldir}/*.whl | xargs basename --multiple | sed -E 's/([^-]+)-([^-]+)-.+\\\.whl/\\\1==\\\2/')
if [ -z $specifier ]; then
echo 'ERROR: %%%%pyproject_install found no wheel in %%%%{_pyproject_wheeldir} %{_pyproject_wheeldir}' >&2
exit 1
fi
TMPDIR="%{_pyproject_builddir}" %{__python3} -m pip install --root %{buildroot} --prefix %{_prefix} --no-deps --disable-pip-version-check --progress-bar off --verbose --ignore-installed --no-warn-script-location --no-index --no-cache-dir --find-links %{_pyproject_wheeldir} $specifier
if [ -d %{buildroot}%{_bindir} ]; then
%py3_shebang_fix %{buildroot}%{_bindir}/*
@ -114,10 +106,12 @@ fi
# Escaping an actual percentage sign in path by 8 signs has been verified in RPM 4.16 and 4.17.
# See this thread http://lists.rpm.org/pipermail/rpm-list/2021-June/002048.html
# Since RPM 4.19, 2 signs are needed instead. 4.18.90+ is a pre-release of RPM 4.19.
# Since RPM 4.19, 2 signs are needed instead.
# On the CI, we build tests/escape_percentages.spec to verify the assumptions.
%pyproject_save_files(lL) %{expand:\\\
%{expr:v"0%{?rpmversion}" >= v"4.18.90" ? "RPM_PERCENTAGES_COUNT=2" : "RPM_PERCENTAGES_COUNT=8" } \\
# We should check RPM version here instead of Fedora/RHEL, but it's hard;
# see https://github.com/rpm-software-management/rpm/issues/2523
%pyproject_save_files() %{expand:\\\
%{expr:0%{?fedora} >= 39 || 0%{?rhel} >= 10 ? "RPM_PERCENTAGES_COUNT=2" : "RPM_PERCENTAGES_COUNT=8" } \\
%{__python3} %{_rpmconfigdir}/redhat/pyproject_save_files.py \\
--output-files "%{pyproject_files}" \\
--output-modules "%{_pyproject_modules}" \\
@ -127,7 +121,7 @@ fi
--python-version "%{python3_version}" \\
--pyproject-record "%{_pyproject_record}" \\
--prefix "%{_prefix}" \\
%{**}
%{*}
}
# -t - Process only top-level modules
@ -141,14 +135,6 @@ fi
}
%_pyproject_check_import_allow_no_modules(e:t) \
if [ -z "$(cat %{_pyproject_modules})" ]; then\
echo "No modules to check found, exiting check"\
else\
%pyproject_check_import %{?**}\
fi
%default_toxenv py%{python3_version_nodots}
%toxenv %{default_toxenv}
@ -164,9 +150,6 @@ fi
%{?_package_note_flags:%_generate_package_note_file}
%{-R:
%{-r:%{error:The -R and -r options are mutually exclusive}}
%{-x:%{error:The -R and -x options are mutually exclusive}}
%{-e:%{error:The -R and -e options are mutually exclusive}}
%{-t:%{error:The -R and -t options are mutually exclusive}}
%{-w:%{error:The -R and -w options are mutually exclusive}}
}
%{-N:

View File

@ -13,7 +13,7 @@ License: MIT
# Increment Y and reset Z when new macros or features are added
# Increment Z when this is a bugfix or a cosmetic change
# Dropping support for EOL Fedoras is *not* considered a breaking change
Version: 1.12.0
Version: 1.9.0
Release: 1%{?dist}
# Macro files
@ -63,20 +63,13 @@ BuildRequires: python3dist(tox-current-env) >= 0.0.6
BuildRequires: python3dist(wheel)
BuildRequires: (python3dist(tomli) if python3 < 3.11)
# RHEL 9: We also run pytest with Python 3.11 and 3.12
# RHEL 9: We also run pytest with Python 3.11
BuildRequires: python3.11dist(pytest)
BuildRequires: python3.11dist(pyyaml)
BuildRequires: python3.11dist(packaging)
BuildRequires: python3.11dist(pip)
BuildRequires: python3.11dist(setuptools)
BuildRequires: python3.11dist(wheel)
BuildRequires: python3.12dist(pytest)
BuildRequires: python3.12dist(pyyaml)
BuildRequires: python3.12dist(packaging)
BuildRequires: python3.12dist(pip)
BuildRequires: python3.12dist(setuptools)
BuildRequires: python3.12dist(wheel)
%endif
# We build on top of those:
@ -92,12 +85,6 @@ Requires: (pyproject-srpm-macros = %{?epoch:%{epoch}:}%{version}-%{release
Requires: /usr/bin/find
Requires: /usr/bin/sed
# This package requires the %%generate_buildrequires functionality.
# It has been introduced in RPM 4.15 (4.14.90 is the alpha of 4.15).
# What we need is rpmlib(DynamicBuildRequires), but that is impossible to (Build)Require.
Requires: (rpm-build >= 4.14.90 if rpm-build)
BuildRequires: rpm-build >= 4.14.90
%description
These macros allow projects that follow the Python packaging specifications
to be packaged as RPMs.
@ -116,7 +103,6 @@ which only work with setup.py.
%package -n pyproject-srpm-macros
Summary: Minimal implementation of %%pyproject_buildrequires
Requires: (pyproject-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} if pyproject-rpm-macros)
Requires: (rpm-build >= 4.14.90 if rpm-build)
%description -n pyproject-srpm-macros
This package contains a minimal implementation of %%pyproject_buildrequires.
@ -131,9 +117,6 @@ takes precedence.
%setup -c -T
cp -p %{sources} .
%generate_buildrequires
# nothing to do, this is here just to assert we have that functionality
%build
# nothing to do, sources are not buildable
@ -163,11 +146,7 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
%pytest -vv --doctest-modules %{?with_pytest_xdist:-n auto} %{!?with_tox_tests:-k "not tox"}
# RHEL 9 only:
%global __pytest pytest-3.11
%pytest -vv --doctest-modules -k "not tox"
# RHEL 9 only:
%global __pytest pytest-3.12
%global __pytest %{__pytest}-3.11
%pytest -vv --doctest-modules -k "not tox"
# brp-compress is provided as an argument to get the right directory macro expansion
@ -194,27 +173,6 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
%changelog
* Fri Jan 26 2024 Miro Hrončok <miro@hroncok.cz> - 1.12.0-1
- Namespace pyproject-rpm-macros generated text files with %%{python3_pkgversion}
- That way, a single-spec can be used to build packages for multiple Python versions
- Fixes: rhbz#2209055
* Wed Sep 27 2023 Miro Hrončok <mhroncok@redhat.com> - 1.11.0-1
- Add the -l/-L flag to %%pyproject_save_files
- The -l flag can be used to assert at least 1 License-File was detected
- The -L flag explicitly disables this check (which remains the default)
- Prevent incorrect usage of %%pyproject_buildrequires -R with -x/-e/-t
- Fixes: rhbz#2244282
- Show a better error message when %%pyproject_install finds no wheel
- Fixes: rhbz#2242452
- Fix %%pyproject_buildrequires -w when the build backend is already installed and pip isn't
- Fixes: rhbz#2169855
* Wed Sep 13 2023 Python Maint <python-maint@redhat.com> - 1.10.0-1
- Add %%_pyproject_check_import_allow_no_modules for automated environments
- Fix handling of tox 4 provision without an explicit tox minversion
- Fixes: rhbz#2240590
* Wed May 31 2023 Maxwell G <maxwell@gtmx.me> - 1.9.0-1
- Allow passing config_settings to the build backend.
@ -254,8 +212,7 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
- Use %%py3_test_envvars in %%tox when available
* Mon Sep 19 2022 Python Maint <python-maint@redhat.com> - 1.4.0-1
- %%pyproject_save_files: Support License-Files installed into the *Root License Directory* from PEP 639
- %%pyproject_save_files: Support License-Files installed into the *Root License Directory* from PEP 369
- %%pyproject_check_import: Import only the modules whose top-level names
match any of the globs provided to %%pyproject_save_files

View File

@ -328,11 +328,6 @@ def generate_run_requirements_wheel(backend, requirements, wheeldir):
# Reuse the wheel from the previous round of %pyproject_buildrequires (if it exists)
wheel = find_built_wheel(wheeldir)
if not wheel:
# pip is already echoed from the macro
# but we need to explicitly restart if has not yet been installed
# see https://bugzilla.redhat.com/2169855
requirements.add('pip >= 19', source='%pyproject_buildrequires -w')
requirements.check(source='%pyproject_buildrequires -w')
import pyproject_wheel
returncode = pyproject_wheel.build_wheel(
wheeldir=wheeldir,
@ -391,7 +386,7 @@ def generate_tox_requirements(toxenv, requirements):
provision_content = provision.read()
if provision_content and r.returncode != 0:
provision_requires = json.loads(provision_content)
if provision_requires.get('minversion') is not None:
if 'minversion' in provision_requires:
requirements.add(f'tox >= {provision_requires["minversion"]}',
source='tox provision (minversion)')
if 'requires' in provision_requires:

View File

@ -365,7 +365,6 @@ Run dependencies with extras and build wheel option:
setuptools: 50
wheel: 1
pyyaml: 1
pip: 20
include_runtime: true
build_wheel: true
extras:
@ -376,7 +375,6 @@ Run dependencies with extras and build wheel option:
python3dist(wheel)
python3dist(wheel)
python3dist(setuptools) >= 40
python3dist(pip) >= 19
python3dist(py) >= 1.5
python3dist(six) >= 1.10
python3dist(setuptools)
@ -591,43 +589,6 @@ tox provision satisfied:
python3dist(inst)
result: 0
tox provision no minversion:
installed:
setuptools: 50
wheel: 1
tox: 3.5.3
tox-current-env: 0.0.6
toxenv:
- py3
setup.py: |
from setuptools import setup
setup(
name='test',
version='0.1',
)
tox.ini: |
[tox]
requires =
setuptools > 40
wheel > 2
expected:
- | # tox 3
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env) >= 0.0.6
python3dist(setuptools) > 40.0
python3dist(wheel) > 2.0
- | # tox 4
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env) >= 0.0.6
python3dist(setuptools) > 40.0
python3dist(wheel) > 2.0
python3dist(tox)
result: 0
Default build system, unmet deps in requirements file:
installed:
setuptools: 50

View File

@ -345,7 +345,7 @@ def classify_paths(
}
license_files = metadata.get_all('License-File')
license_directory = distinfo / 'licenses' # See PEP 639 "Root License Directory"
license_directory = distinfo / 'licenses' # See PEP 369 "Root License Directory"
# setuptools was the first known build backend to implement License-File.
# Unfortunately they don't put licenses to the license directory (yet):
# https://github.com/pypa/setuptools/issues/3596
@ -673,7 +673,7 @@ def load_parsed_record(pyproject_record):
content = json.load(pyproject_record_file)
if len(content) > 1:
raise FileExistsError("%pyproject_install has found more than one *.dist-info/RECORD file. "
raise FileExistsError("%pyproject install has found more than one *.dist-info/RECORD file. "
"Currently, %pyproject_save_files supports only one wheel → one file list mapping. "
"Feel free to open a bugzilla for pyproject-rpm-macros and describe your usecase.")
@ -693,15 +693,12 @@ def dist_metadata(buildroot, record_path):
return dist.metadata
def pyproject_save_files_and_modules(buildroot, sitelib, sitearch, python_version, pyproject_record, prefix, assert_license, varargs):
def pyproject_save_files_and_modules(buildroot, sitelib, sitearch, python_version, pyproject_record, prefix, varargs):
"""
Takes arguments from the %{pyproject_save_files} macro
Returns tuple: list of paths for the %files section and list of module names
for the %check section
Raises ValueError when assert_license is true and no License-File (PEP 639)
is found.
"""
# On 32 bit architectures, sitelib equals to sitearch
# This saves us browsing one directory twice
@ -713,15 +710,11 @@ def pyproject_save_files_and_modules(buildroot, sitelib, sitearch, python_versio
final_file_list = []
final_module_list = []
# we assume OK when not asserting
license_ok = not assert_license
for record_path, files in parsed_records.items():
metadata = dist_metadata(buildroot, record_path)
paths_dict = classify_paths(
record_path, files, metadata, sitedirs, python_version, prefix
)
license_ok = license_ok or bool(paths_dict["metadata"]["licenses"])
final_file_list.extend(
generate_file_list(paths_dict, globs, include_auto)
@ -730,15 +723,6 @@ def pyproject_save_files_and_modules(buildroot, sitelib, sitearch, python_versio
generate_module_list(paths_dict, globs)
)
if not license_ok:
raise ValueError(
"No License-File (PEP 639) in upstream metadata found. "
"Adjust the upstream metadata "
"if the project's build backend supports PEP 639 "
"or use `%pyproject_save_files -L` "
"and include the %license file in %files manually."
)
return final_file_list, final_module_list
@ -750,7 +734,6 @@ def main(cli_args):
cli_args.python_version,
cli_args.pyproject_record,
cli_args.prefix,
cli_args.assert_license,
cli_args.varargs,
)
@ -764,7 +747,7 @@ def argparser():
prog="%pyproject_save_files",
add_help=False,
# custom usage to add +auto
usage="%(prog)s [-l|-L] MODULE_GLOB [MODULE_GLOB ...] [+auto]",
usage="%(prog)s MODULE_GLOB [MODULE_GLOB ...] [+auto]",
)
parser.add_argument(
'--help', action='help',
@ -780,14 +763,6 @@ def argparser():
r.add_argument("--python-version", type=str, required=True, help=argparse.SUPPRESS)
r.add_argument("--pyproject-record", type=PosixPath, required=True, help=argparse.SUPPRESS)
r.add_argument("--prefix", type=PosixPath, required=True, help=argparse.SUPPRESS)
parser.add_argument(
"-l", "--assert-license", action="store_true", default=False,
help="Fail when no License-File (PEP 639) is found.",
)
parser.add_argument(
"-L", "--no-assert-license", action="store_false", dest="assert_license",
help="Don't fail when no License-File (PEP 639) is found (the default).",
)
parser.add_argument(
"varargs", nargs="+", metavar="MODULE_GLOB",
help="Shell-like glob matching top-level module names to save into %%{pyproject_files}",

View File

@ -48,7 +48,7 @@ touch 'escape_percentages/one%%version'
%install
%pyproject_install
%pyproject_save_files -L escape_percentages
%pyproject_save_files escape_percentages
touch '%{buildroot}/two%%version'
@ -58,7 +58,7 @@ grep '/escape_percentages/one' %{pyproject_files}
%files -f %{pyproject_files}
%if v"0%{?rpmversion}" >= v"4.18.90"
%if 0%{?fedora} >= 39 || 0%{?rhel} >= 10
/two%%version
%else
/two%%%%%%%%version

View File

@ -1,7 +1,5 @@
#!/usr/bin/bash -eux
if [ -z "${VERSION_ID-}" ] && [ -z "${NAME-}" ]; then
. /etc/os-release
fi
. /etc/os-release
version=$(echo "${VERSION_ID}" | cut -d. -f1)
arch="x86_64"
@ -36,7 +34,6 @@ if [ ! -f $config ]; then
cp $original $config
echo -e '\n\n' >> $config
echo -e 'config_opts["package_manager"] = "dnf"' >> $config
echo -e 'config_opts["package_manager_max_attempts"] = 10' >> $config
echo -e 'config_opts["package_manager_attempt_delay"] = 60' >> $config
echo -e '\n\nconfig_opts[f"{config_opts.package_manager}.conf"] += """' >> $config
@ -62,8 +59,8 @@ rpmbuild -bs --define '_sourcedir .' ${pkgname}.spec
# build the SRPM in mock
res=0
mock --verbose --isolation=simple -r $config --enablerepo="$repos" init
mock --verbose --isolation=simple -r $config --enablerepo="$repos" "$@" ~/rpmbuild/SRPMS/${pkgname}-*.src.rpm || res=$?
mock --isolation=simple -r $config --enablerepo="$repos" init
mock --isolation=simple -r $config --enablerepo="$repos" "$@" ~/rpmbuild/SRPMS/${pkgname}-*.src.rpm || res=$?
# move the results to the artifacts directory, so we can examine them
artifacts=${TEST_ARTIFACTS:-/tmp/artifacts}

View File

@ -33,7 +33,7 @@ Building this tests that lang files are marked with %%lang in filelist.
%install
%pyproject_install
%pyproject_save_files -l printrun +auto
%pyproject_save_files printrun +auto
%check
@ -52,3 +52,4 @@ grep -E '/printrun/__pycache__$' %{pyproject_files}
%files -f %{pyproject_files}
%doc README*
%license COPYING

View File

@ -42,7 +42,7 @@ sed -Ei "s/(, )?'pytest-runner'//" setup.py
%install
%pyproject_install
%pyproject_save_files -l distroinfo
%pyproject_save_files distroinfo
%check
@ -52,3 +52,4 @@ sed -Ei "s/(, )?'pytest-runner'//" setup.py
%files -n python3-distroinfo -f %{pyproject_files}
%doc README.rst AUTHORS
%license LICENSE

View File

@ -40,7 +40,7 @@ find -name "*.po" | xargs rm -f
%install
%pyproject_install
%pyproject_save_files -l django
%pyproject_save_files django
%check
@ -56,5 +56,6 @@ diff tested.lang expected.lang
%files -n python3-django -f %{pyproject_files}
%doc README.rst
%license LICENSE
%{_bindir}/django-admin
%{_bindir}/django-admin.py

View File

@ -55,8 +55,7 @@ sed -i \
%install
%pyproject_install
# the license is not marked as License-File by poetry-core, hence -L
%pyproject_save_files -L lexicon
%pyproject_save_files lexicon
%check

View File

@ -38,8 +38,7 @@ Summary: %{summary}
%install
%pyproject_install
# the license is not marked as License-File, hence -L
%pyproject_save_files entrypoints -L
%pyproject_save_files entrypoints
%check

View File

@ -42,13 +42,7 @@ cd ..
%install
%pyproject_install
# there is no license file marked as License-File, hence not using -l
%pyproject_save_files flit_core
%check
# internal check for our macros, we assume there is no license
grep -F %%license %{pyproject_files} && exit 1 || true
%files -n python3-flit-core -f %{pyproject_files}

View File

@ -12,10 +12,7 @@ BuildRequires: pyproject-rpm-macros
%global _description %{expand:
Test that manpages are correctly processed by %%%%%%%%pyproject_save_files '*' +auto.
Run %%%%%%%%_pyproject_check_import_allow_no_modules twice
- exclude all modules and test the check still passes thanks to -M option
- regression test: test that check imports all modules even if -M option is set}
Test that manpages are correctly processed by %%pyproject_save_files '*' +auto.}
%description %_description
@ -40,40 +37,14 @@ Summary: %{summary}
%install
%pyproject_install
%pyproject_save_files -l '*' +auto
%pyproject_save_files '*' +auto
%check
# Internal check for our macros, assert the behavior of the import check macros
# Both of the macros should succeed
%pyproject_check_import
%_pyproject_check_import_allow_no_modules
(%{pyproject_check_import}) 2>pyproject_check_import.stderr
(%{_pyproject_check_import_allow_no_modules}) 2>_pyproject_check_import_allow_no_modules.stderr
# Modules were found, stderrs should include getmac.getmac
grep '^Check import: getmac\.getmac$' pyproject_check_import.stderr
grep '^Check import: getmac\.getmac$' _pyproject_check_import_allow_no_modules.stderr
# Now let's pretend no modules were found at all
echo -e '' > %{_pyproject_modules}
# This should fail
(%{pyproject_check_import}) && exit 1 || true
# This should succeed and say something about no modules found
%{_pyproject_check_import_allow_no_modules}
(%{_pyproject_check_import_allow_no_modules}) 2>_pyproject_check_import_allow_no_modules.stderr
grep '\bNo modules to check found\b' _pyproject_check_import_allow_no_modules.stderr
# We want to ensure the rest of the %%check section is still executed
# (To avoid a temptation to call `exit 0` from %%_pyproject_check_import_allow_no_modules)
# We'll touch a marker file here and assert its presence in %%files
touch %{buildroot}/check-completed-entirely
# Internal check for our macros, assert there is a manpage:
test -f %{buildroot}%{_mandir}/man1/getmac.1*
%files -n python3-getmac -f %{pyproject_files}
/check-completed-entirely

View File

@ -56,15 +56,12 @@ sed -Ei 's/\bdef (test_(relative_)?redirect_(to_post|n_(equals_to|higher_than)_1
%install
%pyproject_install
%pyproject_save_files -l httpbin
%pyproject_save_files httpbin
%if %{with tests}
%check
%if 0%{?fedora} < 40 && 0%{?rhel} < 10
# this version of httpbin is not compatible with werkzeug 3+
%tox
%endif
# Internal check for our macros
# The runtime dependencies contain raven[flask], we assert we got them.
@ -75,3 +72,4 @@ sed -Ei 's/\bdef (test_(relative_)?redirect_(to_post|n_(equals_to|higher_than)_1
%files -n python3-httpbin -f %{pyproject_files}
%doc README*
%license LICENSE*

View File

@ -1,5 +1,5 @@
Name: python-ipykernel
Version: 6.11.0
Version: 5.2.1
Release: 0%{?dist}
Summary: IPython Kernel for Jupyter
License: BSD
@ -11,9 +11,6 @@ BuildArch: noarch
BuildRequires: pyproject-rpm-macros
BuildRequires: python3-devel
# some of the nested modules import from this, but upstream does not declare the dependency
BuildRequires: python3-ipyparallel
%description
This package contains data files.
Building this tests that data files are not listed when +auto is not used
@ -34,9 +31,11 @@ Summary: %{summary}
%prep
%autosetup -p1 -n ipykernel-%{version}
# Remove the dependency on debugpy.
# See https://github.com/ipython/ipykernel/pull/767
sed -i '/"debugpy/d' pyproject.toml setup.py
# Add dependency on IPython genutils
# https://github.com/ipython/ipykernel/pull/756
# Patch does not apply, so we dirty-sed it in
sed -i 's/install_requires=\[/install_requires=["ipython_genutils",/' setup.py
%generate_buildrequires
%pyproject_buildrequires -r
@ -46,11 +45,12 @@ sed -i '/"debugpy/d' pyproject.toml setup.py
%install
%pyproject_install
%pyproject_save_files -l 'ipykernel*' +auto
%pyproject_save_files 'ipykernel*' +auto
%check
%pyproject_check_import -e '*.test*' -e 'ipykernel.gui*' -e 'ipykernel.pylab.*' -e 'ipykernel.trio*'
%pyproject_check_import -e '*.test*' -e 'ipykernel.gui*' -e 'ipykernel.pylab.backend_inline'
%files -n python3-ipykernel -f %{pyproject_files}
%license COPYING.md
%doc README.md

View File

@ -9,6 +9,7 @@ License: MIT
URL: https://github.com/timothycrosley/%{modname}
Source0: %{url}/archive/%{version}-2/%{modname}-%{version}-2.tar.gz
BuildArch: noarch
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: pyproject-rpm-macros
%description
@ -17,7 +18,7 @@ Building this tests that executables are not listed when +auto is not used
with %%pyproject_save_files.
This package also uses %%{python3_pkgversion} in name and has a very limited
set of dependencies -- allows to set a different value for it repeatedly.
set of dependencies -- allows to set a different value for it in the CI.
%package -n python%{python3_pkgversion}-%{modname}
Summary: %{summary}
@ -25,24 +26,6 @@ Summary: %{summary}
%description -n python%{python3_pkgversion}-%{modname}
%{summary}.
%if 0%{?rhel} == 9
%global python3_pkgversion 3.11
%package -n python%{python3_pkgversion}-%{modname}
Summary: %{summary}
%description -n python%{python3_pkgversion}-%{modname}
%{summary}.
%global python3_pkgversion 3.12
%package -n python%{python3_pkgversion}-%{modname}
Summary: %{summary}
%description -n python%{python3_pkgversion}-%{modname}
%{summary}.
%global python3_pkgversion 3
%endif
%prep
%autosetup -n %{modname}-%{version}-2
@ -50,40 +33,15 @@ Summary: %{summary}
%generate_buildrequires
%pyproject_buildrequires
%if 0%{?rhel} == 9
%global python3_pkgversion 3.11
%pyproject_buildrequires
%global python3_pkgversion 3.12
%pyproject_buildrequires
%global python3_pkgversion 3
%endif
%build
%pyproject_wheel
%if 0%{?rhel} == 9
%global python3_pkgversion 3.11
%pyproject_wheel
%global python3_pkgversion 3.12
%pyproject_wheel
%global python3_pkgversion 3
%endif
%install
%if 0%{?rhel} == 9
%global python3_pkgversion 3.11
%pyproject_install
%pyproject_save_files -l isort
%global python3_pkgversion 3.12
%pyproject_install
%pyproject_save_files -l isort
%global python3_pkgversion 3
%endif
# we keep this one last so /usr/bin/isort is installed with python3 shebang
%pyproject_install
%pyproject_save_files -l isort
%pyproject_save_files isort
%check
@ -94,32 +52,8 @@ test -d %{buildroot}%{python3_sitelib}/%{modname}-%{version}.dist-info/
# Internal check that executables are not present when +auto was not used with %%pyproject_save_files
grep -F %{_bindir}/%{modname} %{pyproject_files} && exit 1 || true
%if 0%{?rhel} == 9
# Internal check that correct versions are in correct %%{pyproject_files}s
diff %{pyproject_files} <(grep -F python3.9/site-packages %{pyproject_files})
%global python3_pkgversion 3.11
test -d %{buildroot}%{_usr}/lib/python3.11/site-packages/%{modname}/
test -d %{buildroot}%{_usr}/lib/python3.11/site-packages/%{modname}-%{version}.dist-info/
diff %{pyproject_files} <(grep -F python3.11/site-packages %{pyproject_files})
%global python3_pkgversion 3.12
test -d %{buildroot}%{_usr}/lib/python3.12/site-packages/%{modname}/
test -d %{buildroot}%{_usr}/lib/python3.12/site-packages/%{modname}-%{version}.dist-info/
diff %{pyproject_files} <(grep -F python3.12/site-packages %{pyproject_files})
%global python3_pkgversion 3
%endif
%files -n python%{python3_pkgversion}-%{modname} -f %{pyproject_files}
%doc README.rst *.md
%license LICENSE
%{_bindir}/%{modname}
%if 0%{?rhel} == 9
%global python3_pkgversion 3.11
%files -n python%{python3_pkgversion}-%{modname} -f %{pyproject_files}
%doc README.rst *.md
%global python3_pkgversion 3.12
%files -n python%{python3_pkgversion}-%{modname} -f %{pyproject_files}
%doc README.rst *.md
%global python3_pkgversion 3
%endif

View File

@ -61,7 +61,7 @@ PYTHONPATH=%{pyproject_build_lib} %{python3} -c 'import _ldap'
%install
%pyproject_install
# We can pass multiple globs
%pyproject_save_files -l 'ldap*' '*ldap'
%pyproject_save_files 'ldap*' '*ldap'
%check
@ -104,6 +104,7 @@ test "%{pyproject_build_lib}" == "%{_builddir}/%{buildsubdir}/build/lib.%{python
%files -n python3-ldap -f %{pyproject_files}
%license LICENCE
%doc CHANGES README TODO Demo
# Explicitly listed files can be combined with automation
%pycached %{python3_sitearch}/ldif.py

View File

@ -26,6 +26,7 @@ Summary: %{summary}
# In this spec, we put %%files early to test it still works
%files -n python3-markupsafe -f %{pyproject_files}
%license LICENSE.rst
%doc CHANGES.rst README.rst
@ -53,7 +54,7 @@ sed -Ei 's/sphinx\.git@([0-9a-f]+)/sphinx.git@\1#egg=sphinx/' requirements/docs.
%install
%pyproject_install
%pyproject_save_files -l markupsafe
%pyproject_save_files markupsafe
%check

View File

@ -46,7 +46,7 @@ Summary: %summary
%install
%pyproject_install
%pyproject_save_files -l mistune
%pyproject_save_files mistune
%check
@ -61,3 +61,4 @@ test -f %{buildroot}%{python3_sitearch}/mistune.cpython-*.so
%files -n python%{python3_pkgversion}-mistune -f %{pyproject_files}
%doc README.rst
%license LICENSE

View File

@ -45,7 +45,7 @@ sed -i '/mock/d' tests.requires
%install
%pyproject_install
%pyproject_save_files -l %{pypi_name}
%pyproject_save_files %{pypi_name}
%check
@ -54,3 +54,4 @@ sed -i '/mock/d' tests.requires
%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc README.*
%license COPYING

View File

@ -43,7 +43,7 @@ Summary: %{summary}
%install
%pyproject_install
# There are no executables, but we are allowed to pass +auto anyway
%pyproject_save_files pluggy +auto -l
%pyproject_save_files pluggy +auto
%check
@ -52,3 +52,4 @@ Summary: %{summary}
%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc README.rst
%license LICENSE

View File

@ -1,5 +1,5 @@
Name: python-poetry-core
Version: 1.1.0
Version: 1.0.0
Release: 0%{?dist}
Summary: Poetry PEP 517 Build Backend
@ -37,11 +37,8 @@ Summary: %{summary}
%install
%pyproject_install
# the license is not marked as License-File by poetry-core, hence -L
%pyproject_save_files -L poetry
%pyproject_save_files poetry
# internal check for our macros, -l must fail:
%pyproject_save_files -l poetry && exit 1 || true
%files -n python3-poetry-core -f %{pyproject_files}
%doc README.md

View File

@ -1,6 +1,6 @@
%global pypi_name pytest
Name: python-%{pypi_name}
Version: 7.1.3
Version: 6.2.5
Release: 0%{?dist}
Summary: Simple powerful testing with Python
License: MIT
@ -40,8 +40,6 @@ sed -E -i '/mock|nose/d' setup.cfg
# internal check for our macros: insert a subprocess echo to setup.py
# to ensure it's not generated as BuildRequires
echo 'import os; os.system("echo if-this-is-generated-the-build-will-fail")' >> setup.py
# make this build in EPEL 9
sed -i 's/setuptools-scm\[toml\]>=6.2.3/setuptools-scm[toml]>=5/' pyproject.toml
%generate_buildrequires
@ -54,14 +52,14 @@ sed -i 's/setuptools-scm\[toml\]>=6.2.3/setuptools-scm[toml]>=5/' pyproject.toml
%install
%pyproject_install
%pyproject_save_files -l '*pytest' +auto
%pyproject_save_files '*pytest' +auto
%check
%if %{with tests}
# Only run one test (which uses a test-only dependency, hypothesis)
# See how to pass options trough the macro to tox, trough tox to pytest
%tox -- -- -k "metafunc and not test_parametrize_" -Wdefault
%tox -- -- -k metafunc
%else
%pyproject_check_import
%endif
@ -70,3 +68,4 @@ sed -i 's/setuptools-scm\[toml\]>=6.2.3/setuptools-scm[toml]>=5/' pyproject.toml
%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc README.rst
%doc CHANGELOG.rst
%license LICENSE

View File

@ -1,8 +1,8 @@
Name: python-setuptools
# on the CI we test different version of setuptools on different Fedora versions
# don't package software like this in Fedora please
%if 0%{?fedora} || 0%{?rhel} >= 10
Version: 67.7.2
%if 0%{?fedora} >= 37 || 0%{?rhel} >= 10
Version: 65.5.1
%else
Version: 59.6.0
%endif
@ -14,8 +14,8 @@ URL: https://pypi.python.org/pypi/setuptools
Source: %{pypi_source setuptools %{version}}
# Patch from Fedora proper
%if 0%{?fedora} || 0%{?rhel} >= 10
Patch: https://src.fedoraproject.org/rpms/python-setuptools/raw/8ae9b2a777c/f/Remove-optional-or-unpackaged-test-deps.patch
%if 0%{?fedora} >= 37 || 0%{?rhel} >= 10
Patch: https://src.fedoraproject.org/rpms/python-setuptools/raw/b61d86b9659/f/Remove-optional-or-unpackaged-test-deps.patch
%else
Patch: https://src.fedoraproject.org/rpms/python-setuptools/raw/6fc093d6b3d/f/0001-Remove-optional-or-unpackaged-test-deps.patch
%endif
@ -54,7 +54,7 @@ Summary: %{summary}
%prep
%autosetup -p1 -n setuptools-%{version}
%if 0%{?rhel} && 0%{?rhel} < 10
%if 0%{?fedora} < 37 && 0%{?rhel} < 10
# The following test deps are optional and either not desired or not available in Fedora:
sed -Ei setup.cfg -e '/\bpytest-(checkdocs|black|cov|mypy|enabler)\b/d' \
-e '/\bflake8\b/d' \
@ -76,7 +76,7 @@ sed -i pytest.ini -e 's/ --flake8//' \
%install
%pyproject_install
%pyproject_save_files setuptools pkg_resources _distutils_hack -l
%pyproject_save_files setuptools pkg_resources _distutils_hack
# https://github.com/pypa/setuptools/issues/2709
rm -rf %{buildroot}%{python3_sitelib}/pkg_resources/tests/

View File

@ -52,13 +52,13 @@ Summary: %{summary}
%install
%pyproject_install
%pyproject_save_files -l setuptools_scm
%pyproject_save_files setuptools_scm
%check
# This tox should run all the toxenvs specified via -e in %%pyproject_buildrequires
# We only run some of the tests (running all of them requires network connection and is slow)
%tox -- -- -k test_version -Wdefault | tee toxlog
%tox -- -- -k test_version | tee toxlog
# Internal check for our macros: Assert both toxenvs were executed.
grep -E 'py%{python3_version_nodots}-test: (OK|commands succeeded)' toxlog
@ -73,3 +73,4 @@ test "$(cat %{_pyproject_ghost_distinfo})" == "%ghost %{python3_sitelib}/setupto
%files -n python3-setuptools_scm -f %{pyproject_files}
%doc README.rst
%doc CHANGELOG.rst
%license LICENSE

View File

@ -43,7 +43,7 @@ sed -Ei '/^(coverage)$/d' requirements-dev.txt
%install
%pyproject_install
%pyproject_save_files -l userpath
%pyproject_save_files userpath
%check

View File

@ -35,10 +35,6 @@ sed -i -e 's/distlib<1,>=0.3.6/distlib<1,>=0.3.2/' \
-e 's/hatchling>=1.12.2/hatchling>=0.25/' \
-e 's/hatch-vcs>=0.3/hatch-vcs>=0.2.1/' \
pyproject.toml
# Hacky backport of https://src.fedoraproject.org/rpms/python-virtualenv/c/87b1f95664
%if 0%{?fedora} >= 39 || 0%{?rhel} >= 10
sed -i 's/_nonwrappers/_hookimpls/' tests/conftest.py
%endif
%generate_buildrequires
@ -52,7 +48,7 @@ sed -i 's/_nonwrappers/_hookimpls/' tests/conftest.py
%install
%pyproject_install
%pyproject_save_files -l virtualenv
%pyproject_save_files virtualenv
%{?el9:
# old version of setuptools_scm produces files incompatible with
# assumptions in virtualenv code, we append the expected attributes:

View File

@ -32,7 +32,7 @@ Summary: %{summary}
%install
%pyproject_install
%pyproject_save_files -l zope +auto
%pyproject_save_files zope +auto
%check
# Internal check that the RECORD and REQUESTED files are
@ -42,4 +42,5 @@ test ! $(find %{buildroot}%{python3_sitelib}/ | grep -E "\.dist-info/REQUESTED$"
%files -n python3-zope-event -f %{pyproject_files}
%doc README.rst
%license LICENSE.txt

View File

@ -110,15 +110,12 @@
- config-settings-test:
dir: .
run: ./mocktest.sh config-settings-test
- isort_c9s:
- isort_311:
dir: .
run: NAME="CentOS Stream" VERSION_ID=9 ./mocktest.sh python-isort
run: ./mocktest.sh python-isort --define 'python3_pkgversion 3.11'
- mistune_311:
dir: .
run: ./mocktest.sh python-mistune --define 'python3_pkgversion 3.11'
- mistune_312:
dir: .
run: ./mocktest.sh python-mistune --define 'python3_pkgversion 3.12'
required_packages:
- 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm'
- 'https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm'

View File

@ -36,7 +36,7 @@ Building this tests:
%install
%pyproject_install
%pyproject_save_files -l tldr +auto
%pyproject_save_files tldr +auto
%check
# Internal check for our macros: tests we don't ship __pycache__ in bindir
@ -62,4 +62,5 @@ grep '^/app' %{pyproject_files}
%endif
%files -f %pyproject_files
%license LICENSE
%doc README.md