This commit is contained in:
		
							parent
							
								
									7b3e3b30de
								
							
						
					
					
						commit
						197a88bf93
					
				| @ -1,7 +1,7 @@ | |||||||
| Name:           python-rpm-generators | Name:           python-rpm-generators | ||||||
| Summary:        Dependency generators for Python RPMs | Summary:        Dependency generators for Python RPMs | ||||||
| Version:        13 | Version:        14 | ||||||
| Release:        2%{?dist} | Release:        1%{?dist} | ||||||
| 
 | 
 | ||||||
| # Originally all those files were part of RPM, so license is kept here | # Originally all those files were part of RPM, so license is kept here | ||||||
| License:        GPLv2+ | License:        GPLv2+ | ||||||
| @ -47,6 +47,9 @@ install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} *.py | |||||||
| %{_rpmconfigdir}/pythonbundles.py | %{_rpmconfigdir}/pythonbundles.py | ||||||
| 
 | 
 | ||||||
| %changelog | %changelog | ||||||
|  | * Thu Dec 22 2022 Karolina Surma <ksurma@redhat.com> - 14-1 | ||||||
|  | - https://fedoraproject.org/wiki/Changes/Prevent-Providing-python3dist(pkg)=0 | ||||||
|  | 
 | ||||||
| * Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 13-2 | * Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 13-2 | ||||||
| - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild | - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,3 +1,3 @@ | |||||||
| %__pythondist_provides	%{_rpmconfigdir}/pythondistdeps.py --provides --normalized-names-format pep503 --package-name %{name} --majorver-provides-versions %{__default_python3_version} | %__pythondist_provides	%{_rpmconfigdir}/pythondistdeps.py --provides --normalized-names-format pep503 --package-name %{name} --majorver-provides-versions %{__default_python3_version} %{?!_python_dist_allow_version_zero:--fail-if-zero} | ||||||
| %__pythondist_requires	%{_rpmconfigdir}/pythondistdeps.py --requires --normalized-names-format pep503 --package-name %{name} %{?!_python_no_extras_requires:--require-extras-subpackages} --console-scripts-nodep-setuptools-since 3.10 | %__pythondist_requires	%{_rpmconfigdir}/pythondistdeps.py --requires --normalized-names-format pep503 --package-name %{name} %{?!_python_no_extras_requires:--require-extras-subpackages} --console-scripts-nodep-setuptools-since 3.10 | ||||||
| %__pythondist_path		^/usr/lib(64)?/python[3-9]\\.[[:digit:]]+/site-packages/[^/]+\\.(dist-info|egg-info|egg-link)$ | %__pythondist_path		^/usr/lib(64)?/python[3-9]\\.[[:digit:]]+/site-packages/[^/]+\\.(dist-info|egg-info|egg-link)$ | ||||||
|  | |||||||
| @ -155,6 +155,9 @@ class RpmVersion(): | |||||||
|         self.post = None |         self.post = None | ||||||
|         return self |         return self | ||||||
| 
 | 
 | ||||||
|  |     def is_zero(self): | ||||||
|  |         return self.__str__() == '0' | ||||||
|  | 
 | ||||||
|     def __str__(self): |     def __str__(self): | ||||||
|         if self.is_legacy(): |         if self.is_legacy(): | ||||||
|             return self.version |             return self.version | ||||||
| @ -334,9 +337,13 @@ def main(): | |||||||
|                         help="If there is a dependency on a package with extras functionality, require the extras subpackage") |                         help="If there is a dependency on a package with extras functionality, require the extras subpackage") | ||||||
|     parser.add_argument('--package-name', action='store', help="Name of the RPM package that's being inspected. Required for extras requires/provides to work.") |     parser.add_argument('--package-name', action='store', help="Name of the RPM package that's being inspected. Required for extras requires/provides to work.") | ||||||
|     parser.add_argument('--namespace', action='store', help="Namespace for the printed Requires, Provides, Recommends and Conflicts") |     parser.add_argument('--namespace', action='store', help="Namespace for the printed Requires, Provides, Recommends and Conflicts") | ||||||
|  |     parser.add_argument('--fail-if-zero', action='store_true', help='Fail the script if the automatically generated Provides version was 0, which usually indicates a packaging error.') | ||||||
|     parser.add_argument('files', nargs=argparse.REMAINDER, help="Files from the RPM package that are to be inspected, can also be supplied on stdin") |     parser.add_argument('files', nargs=argparse.REMAINDER, help="Files from the RPM package that are to be inspected, can also be supplied on stdin") | ||||||
|     args = parser.parse_args() |     args = parser.parse_args() | ||||||
| 
 | 
 | ||||||
|  |     if args.fail_if_zero and not args.provides: | ||||||
|  |         raise parser.error('--fail-if-zero only works with --provides') | ||||||
|  | 
 | ||||||
|     py_abi = args.requires |     py_abi = args.requires | ||||||
|     py_deps = {} |     py_deps = {} | ||||||
| 
 | 
 | ||||||
| @ -470,6 +477,17 @@ def main(): | |||||||
|                 if dist.version: |                 if dist.version: | ||||||
|                     version = dist.version |                     version = dist.version | ||||||
|                     spec = ('==', version) |                     spec = ('==', version) | ||||||
|  |                     if args.fail_if_zero: | ||||||
|  |                         if RpmVersion(version).is_zero(): | ||||||
|  |                             print('*** PYTHON_PROVIDED_VERSION_NORMALIZES_TO_ZERO___SEE_STDERR ***') | ||||||
|  |                             print(f'\nError: The version in the Python package metadata {version} normalizes to zero.\n' | ||||||
|  |                                   'It\'s likely a packaging error caused by missing version information\n' | ||||||
|  |                                   '(e.g. when using a version control system snapshot as a source).\n' | ||||||
|  |                                   'Try providing the version information manually when building the Python package,\n' | ||||||
|  |                                   'for example by setting the SETUPTOOLS_SCM_PRETEND_VERSION environment variable if the package uses setuptools_scm.\n' | ||||||
|  |                                   'If you are confident that the version of the Python package is intentionally zero,\n' | ||||||
|  |                                   'you may %define the _python_dist_allow_version_zero macro in the spec file to disable this check.\n', file=stderr) | ||||||
|  |                             exit(65)  # os.EX_DATAERR | ||||||
| 
 | 
 | ||||||
|                     if normalized_names_provide_legacy: |                     if normalized_names_provide_legacy: | ||||||
|                         if spec not in py_deps[name]: |                         if spec not in py_deps[name]: | ||||||
|  | |||||||
| @ -1362,4 +1362,39 @@ | |||||||
|             requires: |- |             requires: |- | ||||||
|                 python(abi) = 3.10 |                 python(abi) = 3.10 | ||||||
|                 python3.10dist(virtualenv) >= 20.0.35 |                 python3.10dist(virtualenv) >= 20.0.35 | ||||||
| 
 | --requires --fail-if-zero: | ||||||
|  |     --provides --majorver-provides --fail-if-zero: | ||||||
|  |         usr/lib/python3.11/site-packages/importlib_metadata-0.0-py3.11.egg-info: | ||||||
|  |             stderr: | ||||||
|  |                 provides: |- | ||||||
|  |                     Error: The version in the Python package metadata 0.0 normalizes to zero. | ||||||
|  |                     It's likely a packaging error caused by missing version information | ||||||
|  |                     (e.g. when using a version control system snapshot as a source). | ||||||
|  |                     Try providing the version information manually when building the Python package, | ||||||
|  |                     for example by setting the SETUPTOOLS_SCM_PRETEND_VERSION environment variable if the package uses setuptools_scm. | ||||||
|  |                     If you are confident that the version of the Python package is intentionally zero, | ||||||
|  |                     you may %define the _python_dist_allow_version_zero macro in the spec file to disable this check. | ||||||
|  |                 requires: '*error: --fail-if-zero only works with --provides*' | ||||||
|  |             stdout: | ||||||
|  |                 provides: '*** PYTHON_PROVIDED_VERSION_NORMALIZES_TO_ZERO___SEE_STDERR ***' | ||||||
|  |                 requires: '' | ||||||
|  | --requires: | ||||||
|  |     --provides --majorver-provides: | ||||||
|  |         usr/lib/python3.11/site-packages/importlib_metadata-0.0-py3.11.egg-info: | ||||||
|  |             provides: |- | ||||||
|  |                 python3.11dist(importlib-metadata) = 0 | ||||||
|  |                 python3dist(importlib-metadata) = 0 | ||||||
|  |             requires: |- | ||||||
|  |                 python(abi) = 3.11 | ||||||
|  |                 python3.11dist(setuptools) | ||||||
|  |                 python3.11dist(wheel) | ||||||
|  | --requires: | ||||||
|  |     --provides --majorver-provides --fail-if-zero: | ||||||
|  |         usr/lib/python3.11/site-packages/importlib_metadata-0.1-py3.11.egg-info: | ||||||
|  |             provides: |- | ||||||
|  |                 python3.11dist(importlib-metadata) = 0.1 | ||||||
|  |                 python3dist(importlib-metadata) = 0.1 | ||||||
|  |             requires: |- | ||||||
|  |                 python(abi) = 3.11 | ||||||
|  |                 python3.11dist(setuptools) | ||||||
|  |                 python3.11dist(wheel) | ||||||
|  | |||||||
| @ -103,3 +103,7 @@ dnspython: | |||||||
| build: | build: | ||||||
|     wheel: |     wheel: | ||||||
|         '0.8.0': ['3.10'] |         '0.8.0': ['3.10'] | ||||||
|  | importlib_metadata: | ||||||
|  |     sdist: | ||||||
|  |         '0.0': ['3.11'] | ||||||
|  |         '0.1': ['3.11'] | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user