Skip to content

Commit b67c95d

Browse files
authored
Changes for building rpms (#1248)
1 parent 03e71e6 commit b67c95d

4 files changed

Lines changed: 37 additions & 25 deletions

File tree

data/projects.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,6 @@ dpkg_dependencies: python3-click,python3-itsdangerous,python3-jinja2,python3-wer
507507
dpkg_name: python-flor
508508
dpkg_source_name: flor
509509
rpm_template_spec: Flor.spec
510-
wheel_name: flor
511510
maintainer: Andreas Dewes <andreas.dewes@dcso.de>
512511
homepage_url: https://github.com/DCSO/flor
513512
download_url: https://pypi.org/project/Flor
@@ -1665,6 +1664,7 @@ version: >=1.5.5.1
16651664
maintainer: Sergey Dryabzhinsky <sergey.dryabzhinsky@gmail.com>
16661665
rpm_template_spec: zstd.spec
16671666
setup_name: zstd
1667+
wheel_name: zstd
16681668
homepage_url: https://github.com/sergey-dryabzhinsky/python-zstd
16691669
download_url: https://pypi.org/project/zstd/
16701670
git_url: https://github.com/sergey-dryabzhinsky/python-zstd.git
@@ -1998,7 +1998,7 @@ build_system: setuptools
19981998
disabled: windows
19991999
dpkg_build_dependencies: python3-cffi,python3-setuptools,python3-toml,python3-wheel
20002000
dpkg_name: python-xattr
2001-
rpm_build_dependencies: python3-cffi,python3-pip,python3-setuptools,python3-wheel
2001+
rpm_build_dependencies: python3-cffi,python3-pip,python3-setuptools,python3-wheel,tox
20022002
rpm_name: python-xattr
20032003
maintainer: John Machin <sjmachin@lexicon.net>
20042004
license: MIT

data/templates/github_actions/test_tox.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ jobs:
1414
strategy:
1515
matrix:
1616
include:
17-
- python-version: '3.9'
18-
toxenv: 'py39,wheel'
1917
- python-version: '3.10'
2018
toxenv: 'py310,wheel'
2119
- python-version: '3.11'

data/templates/setup.cfg/metadata

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ install_requires = file:requirements.txt
2222
package_dir =
2323
${python_module_name} = ${python_module_name}
2424
packages = find:
25-
python_requires = >=3.9
25+
python_requires = >=3.10

tools/update.py

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,27 @@ class DependencyUpdater(object):
265265
'org.python.pypi.',
266266
'net.sourceforge.projects.']
267267

268+
# Some projects have different PyPI names than their project names.
269+
_PYPI_ALIASES = {
270+
'flor': 'Flor',
271+
'lz4': 'python-lz4',
272+
'redis': 'redis-py',
273+
'snappy': 'python-snappy',
274+
'zstd': 'python-zstd'}
275+
276+
# Some projects have different wheel names in l2tbinaries than defined
277+
# in their project definitions.
278+
# TODO: remove after l2tbinaries Python 3.14 upgrade.
279+
_WHEEL_ALIASES = {
280+
'bencode.py': 'bencode_py',
281+
'PyYAML': 'pyyaml',
282+
'XlsxWriter': 'xlsxwriter'}
283+
268284
# Some projects have different wheel names than their project names.
269-
_ALTERNATE_NAMES = {
270-
# TODO: remove bencode.py after Python 3.14 upgrade.
285+
_PROJECT_ALIASES = {
271286
'bencode.py': 'bencode',
272287
'bencode_py': 'bencode',
273-
'flor': 'Flor',
274288
'lz4': 'python-lz4',
275-
'pyyaml': 'PyYAML',
276289
'zstd': 'python-zstd'}
277290

278291
def __init__(
@@ -376,18 +389,18 @@ def _GetAvailableWheelPackages(self):
376389

377390
def _GetWheelPackageFilenamesAndVersions(
378391
self, project_definitions, available_packages,
379-
user_defined_package_names):
392+
user_defined_wheel_package_names):
380393
"""Determines the wheel package filenames and versions.
381394
382395
Args:
383396
project_definitions (dist[str, ProjectDefinition]): project definitions
384397
per name.
385398
available_packages (list[PackageDownload]): packages available for
386399
download.
387-
user_defined_package_names (list[str]): names of packages that should be
388-
updated if an update is available. These package names are derived
389-
from the user specified names of projects. An empty list represents
390-
all available packages.
400+
user_defined_wheel_package_names (list[str]): names of the wheels of
401+
packages that should be updated if an update is available. These
402+
package names are derived from the user specified names of projects.
403+
An empty list represents all available packages.
391404
392405
Returns:
393406
tuple: containing:
@@ -411,14 +424,15 @@ def _GetWheelPackageFilenamesAndVersions(
411424
self._download_directory, package_filename)
412425

413426
# Ignore package names if user defined.
414-
if user_defined_package_names:
415-
in_package_names = package_name in user_defined_package_names
427+
if user_defined_wheel_package_names:
428+
in_package_names = package_name in user_defined_wheel_package_names
416429

417-
alternate_name = self._ALTERNATE_NAMES.get(package_name, None)
430+
alternate_name = self._WHEEL_ALIASES.get(package_name, None)
418431
if alternate_name:
419432
if ((self._exclude_packages and in_package_names) or
420433
(not self._exclude_packages and not in_package_names)):
421-
in_package_names = alternate_name in user_defined_package_names
434+
in_package_names = (
435+
alternate_name in user_defined_wheel_package_names)
422436

423437
if ((self._exclude_packages and in_package_names) or
424438
(not self._exclude_packages and not in_package_names)):
@@ -438,7 +452,7 @@ def _GetWheelPackageFilenamesAndVersions(
438452
project_definition = project_definition_per_package_name.get(
439453
package_name, None)
440454
if not project_definition:
441-
alternate_name = self._ALTERNATE_NAMES.get(package_name, None)
455+
alternate_name = self._PROJECT_ALIASES.get(package_name, None)
442456
if alternate_name:
443457
project_definition = project_definitions.get(alternate_name, None)
444458

@@ -494,11 +508,11 @@ def _GetUserDefinedWheelPackageNames(
494508
available. These package names are derived from the user specified
495509
names of projects. An empty list represents all available packages.
496510
"""
497-
user_defined_package_names = []
511+
user_defined_wheel_package_names = []
498512
for project_name in user_defined_project_names:
499513
project_definition = project_definitions.get(project_name, None)
500514
if not project_definition:
501-
alternate_name = self._ALTERNATE_NAMES.get(project_name, None)
515+
alternate_name = self._PYPI_ALIASES.get(project_name, None)
502516
if alternate_name:
503517
project_definition = project_definitions.get(alternate_name, None)
504518

@@ -511,9 +525,9 @@ def _GetUserDefinedWheelPackageNames(
511525
project_definition, 'wheel_name', None) or project_name
512526

513527
package_name = package_name.lower()
514-
user_defined_package_names.append(package_name)
528+
user_defined_wheel_package_names.append(package_name)
515529

516-
return user_defined_package_names
530+
return user_defined_wheel_package_names
517531

518532
def _InstallWheelPackagesWindows(self, package_filenames, package_versions):
519533
"""Installs wheel packages on Windows.
@@ -582,7 +596,7 @@ def UpdatePackages(self, projects_file, user_defined_project_names):
582596
"""
583597
project_definitions = self._GetProjectDefinitions(projects_file)
584598

585-
user_defined_package_names = self._GetUserDefinedWheelPackageNames(
599+
user_defined_wheel_package_names = self._GetUserDefinedWheelPackageNames(
586600
project_definitions, user_defined_project_names)
587601

588602
available_packages = self._GetAvailableWheelPackages()
@@ -596,7 +610,7 @@ def UpdatePackages(self, projects_file, user_defined_project_names):
596610
package_filenames, package_versions = (
597611
self._GetWheelPackageFilenamesAndVersions(
598612
project_definitions, available_packages,
599-
user_defined_package_names))
613+
user_defined_wheel_package_names))
600614

601615
if self._download_only:
602616
return True

0 commit comments

Comments
 (0)