Sync with upstream RPM
- Handle version ending with ".*" - Handle compatible-release operator "~=" - Use rich deps for semantically versioned dependencies - Match Python version if minor has multiple digits (e.g. 3.10) - Only add setuptools requirement for egg-info packages https://github.com/rpm-software-management/rpm/pull/951 https://github.com/rpm-software-management/rpm/pull/973 https://github.com/rpm-software-management/rpm/pull/982 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1758141 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1777382
This commit is contained in:
		
							parent
							
								
									b9fe0e7182
								
							
						
					
					
						commit
						ca811dbf35
					
				| @ -4,8 +4,8 @@ | |||||||
| 
 | 
 | ||||||
| Name:           python-rpm-generators | Name:           python-rpm-generators | ||||||
| Summary:        Dependency generators for Python RPMs | Summary:        Dependency generators for Python RPMs | ||||||
| Version:        9 | Version:        10 | ||||||
| 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+ | ||||||
| @ -49,6 +49,13 @@ install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} pythondeps.sh pythondistdeps.py | |||||||
| %{_rpmconfigdir}/pythondistdeps.py | %{_rpmconfigdir}/pythondistdeps.py | ||||||
| 
 | 
 | ||||||
| %changelog | %changelog | ||||||
|  | * Wed Jan 01 2020 Miro Hrončok <mhroncok@redhat.com> - 10-1 | ||||||
|  | - Handle version ending with ".*" (#1758141) | ||||||
|  | - Handle compatible-release operator "~=" (#1758141) | ||||||
|  | - Use rich deps for semantically versioned dependencies | ||||||
|  | - Match Python version if minor has multiple digits (e.g. 3.10, #1777382) | ||||||
|  | - Only add setuptools requirement for egg-info packages | ||||||
|  | 
 | ||||||
| * Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 9-2 | * Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 9-2 | ||||||
| - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild | - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -102,7 +102,7 @@ for f in files: | |||||||
|             lower.endswith('.egg-info') or \ |             lower.endswith('.egg-info') or \ | ||||||
|             lower.endswith('.dist-info'): |             lower.endswith('.dist-info'): | ||||||
|         # This import is very slow, so only do it if needed |         # This import is very slow, so only do it if needed | ||||||
|         from pkg_resources import Distribution, FileMetadata, PathMetadata, Requirement |         from pkg_resources import Distribution, FileMetadata, PathMetadata, Requirement, parse_version | ||||||
|         dist_name = basename(f) |         dist_name = basename(f) | ||||||
|         if isdir(f): |         if isdir(f): | ||||||
|             path_item = dirname(f) |             path_item = dirname(f) | ||||||
| @ -116,7 +116,7 @@ for f in files: | |||||||
|             # Try to parse the Python version from the path the metadata |             # Try to parse the Python version from the path the metadata | ||||||
|             # resides at (e.g. /usr/lib/pythonX.Y/site-packages/...) |             # resides at (e.g. /usr/lib/pythonX.Y/site-packages/...) | ||||||
|             import re |             import re | ||||||
|             res = re.search(r"/python(?P<pyver>\d+\.\d)/", path_item) |             res = re.search(r"/python(?P<pyver>\d+\.\d+)/", path_item) | ||||||
|             if res: |             if res: | ||||||
|                 dist.py_version = res.group('pyver') |                 dist.py_version = res.group('pyver') | ||||||
|             else: |             else: | ||||||
| @ -184,8 +184,10 @@ for f in files: | |||||||
|                             depsextras.remove(dep) |                             depsextras.remove(dep) | ||||||
|                 deps = depsextras |                 deps = depsextras | ||||||
|             # console_scripts/gui_scripts entry points need pkg_resources from setuptools |             # console_scripts/gui_scripts entry points need pkg_resources from setuptools | ||||||
|             if (dist.get_entry_map('console_scripts') or |             if ((dist.get_entry_map('console_scripts') or | ||||||
|                     dist.get_entry_map('gui_scripts')): |                      dist.get_entry_map('gui_scripts')) and | ||||||
|  |                     (lower.endswith('.egg') or | ||||||
|  |                      lower.endswith('.egg-info'))): | ||||||
|                 # stick them first so any more specific requirement overrides it |                 # stick them first so any more specific requirement overrides it | ||||||
|                 deps.insert(0, Requirement.parse('setuptools')) |                 deps.insert(0, Requirement.parse('setuptools')) | ||||||
|             # add requires/recommends based on egg/dist metadata |             # add requires/recommends based on egg/dist metadata | ||||||
| @ -248,11 +250,35 @@ names.sort() | |||||||
| for name in names: | for name in names: | ||||||
|     if py_deps[name]: |     if py_deps[name]: | ||||||
|         # Print out versioned provides, requires, recommends, conflicts |         # Print out versioned provides, requires, recommends, conflicts | ||||||
|  |         spec_list = [] | ||||||
|         for spec in py_deps[name]: |         for spec in py_deps[name]: | ||||||
|             if spec[0] == '!=': |             if spec[0] == '!=': | ||||||
|                 print('({n} < {v} or {n} >= {v}.0)'.format(n=name, v=spec[1])) |                 spec_list.append('{n} < {v} or {n} >= {v}.0'.format(n=name, v=spec[1])) | ||||||
|  |             elif spec[0] == '~=': | ||||||
|  |                 # Parse the current version | ||||||
|  |                 next_ver = parse_version(spec[1]).base_version.split('.') | ||||||
|  |                 # Drop the micro version | ||||||
|  |                 next_ver = next_ver[0:-1] | ||||||
|  |                 # Increment the minor version | ||||||
|  |                 next_ver[-1] = str(int(next_ver[-1]) + 1) | ||||||
|  |                 next_ver = '.'.join(next_ver) | ||||||
|  |                 spec_list.append('{n} >= {v} with {n} < {vnext}'.format(n=name, v=spec[1], vnext=next_ver)) | ||||||
|  |             elif spec[0] == '==' and spec[1].endswith('.*'): | ||||||
|  |                 # Parse the current version | ||||||
|  |                 next_ver = parse_version(spec[1]).base_version.split('.') | ||||||
|  |                 # Drop the micro version from both the version in spec and next_ver | ||||||
|  |                 next_ver = next_ver[0:-1] | ||||||
|  |                 spec = (spec[0], '.'.join(next_ver)) | ||||||
|  |                 # Increment the minor version | ||||||
|  |                 next_ver[-1] = str(int(next_ver[-1]) + 1) | ||||||
|  |                 next_ver = '.'.join(next_ver) | ||||||
|  |                 spec_list.append('{n} >= {v} with {n} < {vnext}'.format(n=name, v=spec[1], vnext=next_ver)) | ||||||
|             else: |             else: | ||||||
|                 print('{} {} {}'.format(name, spec[0], spec[1])) |                 spec_list.append('{} {} {}'.format(name, spec[0], spec[1])) | ||||||
|  |         if len(spec_list) == 1: | ||||||
|  |             print(spec_list[0]) | ||||||
|  |         else: | ||||||
|  |             print('({})'.format(' with '.join(spec_list))) | ||||||
|     else: |     else: | ||||||
|         # Print out unversioned provides, requires, recommends, conflicts |         # Print out unversioned provides, requires, recommends, conflicts | ||||||
|         print(name) |         print(name) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user