Skip to content

photon-os-installer: fix pkg_resources deprecation#1642

Open
dcasota wants to merge 1 commit intovmware:5.0from
dcasota:fix-btrfs-installer-upstream
Open

photon-os-installer: fix pkg_resources deprecation#1642
dcasota wants to merge 1 commit intovmware:5.0from
dcasota:fix-btrfs-installer-upstream

Conversation

@dcasota
Copy link
Copy Markdown
Contributor

@dcasota dcasota commented Apr 3, 2026

Problem

The photon-os-installer v2.7 source tarball uses pkg_resources (from setuptools) to resolve its own version in photon_installer/__init__.py. pkg_resources is deprecated in setuptools 67.5+ and will be removed in a future release. On Photon OS 5.0 (subrelease >= 92) with Python 3.14 and setuptools 80.x, pkg_resources is still shipped but triggers deprecation warnings and is on the removal path.

Fix

Patch: fix-pkg-resources.patch (Patch1, Release 2.7-6):

  • Replace import pkg_resources / pkg_resources.get_distribution(__name__).version with from importlib.metadata import version / version(__name__), matching the approach already used in upstream master.

The patch applies to the existing source tarball via %autosetup -p1. No source tarball SHA change is needed.

Note: The upstream source tarball already contains the btrfs-progs auto-install logic (self._add_packages_to_install('btrfs-progs') in installer.py), so no separate btrfs-progs fix is required.

Testing

Python version Without PR With PR
3.11 (pinned91) Works (deprecation warning) Works (no warning)
3.14 (>= 92) Works (deprecation warning, future removal risk) Works (no warning)

Tested on Photon 5.0 (pinned subrelease 91 and normal) and Photon 6.0, on VMware Workstation (UEFI, TPM 2.0, VM encryption).

Replace deprecated pkg_resources with importlib.metadata in
photon_installer/__init__.py via patch. This prevents breakage
when setuptools removes pkg_resources in a future release.

The btrfs-progs auto-install is already in the upstream source
tarball, so no tarball SHA change is needed.

Change-Id: Ibebe410a4ea70269b77c6e43ab9167ff6772b2c4
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@dcasota dcasota force-pushed the fix-btrfs-installer-upstream branch from 611ed25 to cf5d1d1 Compare April 12, 2026 22:21
@dcasota dcasota changed the title photon-os-installer: add btrfs-progs, fix pkg_resources deprecation photon-os-installer: fix pkg_resources deprecation Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant