On 20. 02. 21 12:22, Miro Hrončok wrote:
On 20. 02. 21 12:16, Miro Hrončok wrote:
> On 20. 02. 21 12:06, Frank R Dana Jr. wrote:
>> I recently committed[1] an updated package spec for python-webscrapbook[2].
>> Its setup.py file contains the following lines:
>>
>> extras_require={
>> "adhoc_ssl": ["cryptography"],
>> },
>>
>> I therefore wanted to include 'adhoc_ssl' as a Python Extras subpackage,
as
>> documented[3] in the Packaging Guidelines.
>>
>> However, if I remove the '%if 0' wrapper around line 36 in my spec file:
>>
>> %{?python_extras_subpkg:%python_extras_subpkg -n
>> python%{python3_pkgversion}-%{pypi_name} -i %{python3_sitelib}/*.egg-info
>> adhoc_ssl }
>>
>> a `fedpkg --release f33 local` build fails with the following errors:
>>
>> ~~~~~~~~~~~~~~~~
>> Processing files: python3-webscrapbook+adhoc-0.33.3-1.fc33.noarch
>>
>> Error: The package name contains an extras name `adhoc` that was not found in
>> the metadata.
>> Check if the extras were removed from the project. If so, consider removing
>> the subpackage and obsoleting it from another.
>>
>> error: Dependency tokens must begin with alpha-numeric, '_' or
'/': ***
>> PYTHON_EXTRAS_NOT_FOUND_ERROR___SEE_STDERR ***
>>
>> Error: The package name contains an extras name `adhoc` that was not found in
>> the metadata.
>> Check if the extras were removed from the project. If so, consider removing
>> the subpackage and obsoleting it from another.
>>
>> error: Dependency tokens must begin with alpha-numeric, '_' or
'/': ***
>> PYTHON_EXTRAS_NOT_FOUND_ERROR___SEE_STDERR ***
>> Provides: python-webscrapbook+adhoc = 0.33.3-1.fc33
>> python3-webscrapbook+adhoc = 0.33.3-1.fc33 python3.9-webscrapbook+adhoc =
>> 0.33.3-1.fc33
>> ~~~~~~~~~~~~~~~~
>>
>> ...As you can see, it's trying to package a nonexistent extra named
>> 'python3-webscrapbook+adhoc', rather than the expected
>> 'python3-webscrapbook_adhoc_ssl'.
>>
>> Running `pip3 install --user 'webscrapbook[adhoc_ssl]`, executes fine (and
>> checks
>> that the cryptography package was installed, as required by the adhoc_ssl
>> extra),
>> so 'adhoc_ssl' does appear to be a valid Python package extra name.
>>
>> I tried wrapping the extra name in double quotes, I tried backslash-escaping the
>> underscore... nothing seems to work.
>>
>> * Am I doing something wrong?
>> * Do the RPM macros for extras not support names with underscores?
>> * Is there any way to convince them to take an extra name containing an
>> underscore?
>>
>> [1]:
>>
https://src.fedoraproject.org/rpms/python-webscrapbook/c/26f5e10fe03aa5b6...
>>
>> [2]:
https://src.fedoraproject.org/rpms/python-webscrapbook
>> [3]:
>>
https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_python...
>
> This is a bug! Thanks for the report.
OK, so the macro apparently splits the argument on underscores:
$ rpm --eval '%{?python_extras_subpkg:%python_extras_subpkg -n python3-foo -i
%{python3_sitelib}/*.egg-info adhoc_ssl }'
%package -n python3-foo+adhoc
Summary: Metapackage for python3-foo: adhoc extras
Requires: python3-foo = %{version}-%{release}
%description -n python3-foo+adhoc
This is a metapackage bringing in adhoc extras requires for python3-foo.
It contains no code, just makes sure the dependencies are installed.
%files -n python3-foo+adhoc
%ghost /usr/lib/python3.9/site-packages/*.egg-info
%package -n python3-foo+ssl
Summary: Metapackage for python3-foo: ssl extras
Requires: python3-foo = %{version}-%{release}
%description -n python3-foo+ssl
This is a metapackage bringing in ssl extras requires for python3-foo.
It contains no code, just makes sure the dependencies are installed.
%files -n python3-foo+ssl
%ghost /usr/lib/python3.9/site-packages/*.egg-info
This is caused by a bug in this logic of the macro:
In [1]: args = 'foo_bar baz'
In [2]: for extras in args:gmatch('%w+') do
...: print(extras)
...: end
foo
bar
baz
The "%w" pattern means "alphanumeric characters" which does not
include
underscore. We should use "%S" which means "NOT space characters".
In [3]: for extras in args:gmatch('%S+') do
...: print(extras)
...: end
foo_bar
baz
I'll submit a fix shortly.