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?
This is a bug! Thanks for the report.
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?
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.
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?
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.
https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/88
On 20. 02. 21 12:53, Miro Hrončok wrote:
I'll submit a fix shortly.
https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/88
The fix should be in here:
F33: https://bodhi.fedoraproject.org/updates/FEDORA-2021-4afa5ada33 F34: https://bodhi.fedoraproject.org/updates/FEDORA-2021-7aa3f311d5 F35: https://bodhi.fedoraproject.org/updates/FEDORA-2021-56ad871a72
It is available in the buildroot (build with --enablerepo=local if using mock).
See also: https://src.fedoraproject.org/rpms/python-webscrapbook/pull-request/1
Thanks fro the report and sorry for the trouble.
python-devel@lists.fedoraproject.org