Allow commas as argument separator for extras names in %python_extras_subpkg
This allows e.g.: %global extras cli,ghostwriter,pytz,dateutil,lark,numpy,pandas,pytest,redis,zoneinfo,django %{pyproject_extras_subpkg -n python3-hypothesis %{extras}} ... %pyproject_buildrequires -x %{extras} (Note that %pyproject_extras_subpkg is a tiny wrapper around %python_extras_subpkg.)
This commit is contained in:
parent
bc016cbbc5
commit
a44ae31ad0
|
@ -198,7 +198,7 @@
|
||||||
rpm.expand('%{error:%%%0 requires at least one argument with "extras" name}')
|
rpm.expand('%{error:%%%0 requires at least one argument with "extras" name}')
|
||||||
end
|
end
|
||||||
local requires = 'Requires: ' .. value_n .. ' = %{?epoch:%{epoch}:}%{version}-%{release}'
|
local requires = 'Requires: ' .. value_n .. ' = %{?epoch:%{epoch}:}%{version}-%{release}'
|
||||||
for extras in args:gmatch('%S+') do
|
for extras in args:gmatch('[^%s,]+') do
|
||||||
local rpmname = value_n .. '+' .. extras
|
local rpmname = value_n .. '+' .. extras
|
||||||
local pkgdef = '%package -n ' .. rpmname
|
local pkgdef = '%package -n ' .. rpmname
|
||||||
local summary = 'Summary: Metapackage for ' .. value_n .. ': ' .. extras .. ' extras'
|
local summary = 'Summary: Metapackage for ' .. value_n .. ': ' .. extras .. ' extras'
|
||||||
|
|
|
@ -22,7 +22,7 @@ License: MIT and Python
|
||||||
# The macro is defined in python-srpm-macros.
|
# The macro is defined in python-srpm-macros.
|
||||||
%{load:%{SOURCE102}}
|
%{load:%{SOURCE102}}
|
||||||
Version: %{__default_python3_version}
|
Version: %{__default_python3_version}
|
||||||
Release: 35%{?dist}
|
Release: 36%{?dist}
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
|
@ -95,6 +95,10 @@ install -m 644 compileall2.py %{buildroot}%{_rpmconfigdir}/redhat/
|
||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Mar 29 2021 Miro Hrončok <mhroncok@redhat.com> - 3.9-36
|
||||||
|
- Allow commas as argument separator for extras names in %%python_extras_subpkg
|
||||||
|
- Fixes: rhbz#1936486
|
||||||
|
|
||||||
* Sat Feb 20 2021 Miro Hrončok <mhroncok@redhat.com> - 3.9-35
|
* Sat Feb 20 2021 Miro Hrončok <mhroncok@redhat.com> - 3.9-35
|
||||||
- Fix %%python_extras_subpkg with underscores in extras names
|
- Fix %%python_extras_subpkg with underscores in extras names
|
||||||
|
|
||||||
|
|
|
@ -424,6 +424,47 @@ def test_python_extras_subpkg_underscores():
|
||||||
assert lines == expected
|
assert lines == expected
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('sep', [pytest.param(('', ' ', ' ', ''), id='spaces'),
|
||||||
|
pytest.param(('', ',', ',', ''), id='commas'),
|
||||||
|
pytest.param(('', ',', ',', ','), id='commas-trailing'),
|
||||||
|
pytest.param((',', ',', ',', ''), id='commas-leading'),
|
||||||
|
pytest.param((',', ',', ',', ','), id='commas-trailing-leading'),
|
||||||
|
pytest.param(('', ',', ' ', ''), id='mixture'),
|
||||||
|
pytest.param((' ', ' ', '\t\t, ', '\t'), id='chaotic-good'),
|
||||||
|
pytest.param(('', '\t ,, \t\r ', ',,\t , ', ',,'), id='chaotic-evil')])
|
||||||
|
def test_python_extras_subpkg_arg_separators(sep):
|
||||||
|
lines = rpm_eval('%python_extras_subpkg -n python3-hypothesis -F {}cli{}ghostwriter{}pytz{}'.format(*sep),
|
||||||
|
version='6.6.0', release='1.fc35')
|
||||||
|
expected = textwrap.dedent(f"""
|
||||||
|
%package -n python3-hypothesis+cli
|
||||||
|
Summary: Metapackage for python3-hypothesis: cli extras
|
||||||
|
Requires: python3-hypothesis = 6.6.0-1.fc35
|
||||||
|
%description -n python3-hypothesis+cli
|
||||||
|
This is a metapackage bringing in cli extras requires for python3-hypothesis.
|
||||||
|
It makes sure the dependencies are installed.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%package -n python3-hypothesis+ghostwriter
|
||||||
|
Summary: Metapackage for python3-hypothesis: ghostwriter extras
|
||||||
|
Requires: python3-hypothesis = 6.6.0-1.fc35
|
||||||
|
%description -n python3-hypothesis+ghostwriter
|
||||||
|
This is a metapackage bringing in ghostwriter extras requires for
|
||||||
|
python3-hypothesis.
|
||||||
|
It makes sure the dependencies are installed.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%package -n python3-hypothesis+pytz
|
||||||
|
Summary: Metapackage for python3-hypothesis: pytz extras
|
||||||
|
Requires: python3-hypothesis = 6.6.0-1.fc35
|
||||||
|
%description -n python3-hypothesis+pytz
|
||||||
|
This is a metapackage bringing in pytz extras requires for python3-hypothesis.
|
||||||
|
It makes sure the dependencies are installed.
|
||||||
|
""").lstrip().splitlines()
|
||||||
|
assert lines == expected
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('basename_len', [1, 10, 30, 45, 78])
|
@pytest.mark.parametrize('basename_len', [1, 10, 30, 45, 78])
|
||||||
@pytest.mark.parametrize('extra_len', [1, 13, 28, 52, 78])
|
@pytest.mark.parametrize('extra_len', [1, 13, 28, 52, 78])
|
||||||
def test_python_extras_subpkg_description_wrapping(basename_len, extra_len):
|
def test_python_extras_subpkg_description_wrapping(basename_len, extra_len):
|
||||||
|
|
Loading…
Reference in New Issue