diff --git a/src/rez_pip/data/patches/pyside6_6_0_0_win_dll_path.patch b/src/rez_pip/data/patches/pyside6_6_0_0_win_dll_path.patch new file mode 100644 index 0000000..cb60541 --- /dev/null +++ b/src/rez_pip/data/patches/pyside6_6_0_0_win_dll_path.patch @@ -0,0 +1,20 @@ +--- python/PySide6/__init__.py 2025-01-11 15:01:54.266726602 -0500 ++++ python/PySide6/__init__.py 2025-01-11 15:06:19.646365323 -0500 +@@ -10,14 +10,9 @@ + + + def _additional_dll_directories(package_dir): +- # Find shiboken6 relative to the package directory. +- root = os.path.dirname(package_dir) +- # Check for a flat .zip as deployed by cx_free(PYSIDE-1257) +- if root.endswith('.zip'): +- return [] +- shiboken6 = os.path.join(root, 'shiboken6') +- if os.path.isdir(shiboken6): # Standard case, only shiboken6 is needed +- return [shiboken6] ++ # rez-pip patch: Return the path to the shiboken rez package ++ return [os.path.join(os.environ["REZ_SHIBOKEN6_ROOT"], "python", "shiboken6")] ++ + # The below code is for the build process when generate_pyi.py + # is executed in the build directory. We need libpyside and Qt in addition. + shiboken6 = os.path.join(os.path.dirname(root), 'shiboken6', 'libshiboken') diff --git a/src/rez_pip/data/patches/pyside6_6_1_0_win_dll_path.patch b/src/rez_pip/data/patches/pyside6_6_1_0_win_dll_path.patch new file mode 100644 index 0000000..6c9cce8 --- /dev/null +++ b/src/rez_pip/data/patches/pyside6_6_1_0_win_dll_path.patch @@ -0,0 +1,20 @@ +--- python/PySide6/__init__.py 2025-01-11 14:43:26.190668073 -0500 ++++ python/PySide6/__init__.py 2025-01-11 15:09:43.741718533 -0500 +@@ -11,14 +11,9 @@ + + + def _additional_dll_directories(package_dir): +- # Find shiboken6 relative to the package directory. +- root = Path(package_dir).parent +- # Check for a flat .zip as deployed by cx_free(PYSIDE-1257) +- if root.suffix == '.zip': +- return [] +- shiboken6 = root / 'shiboken6' +- if shiboken6.is_dir(): # Standard case, only shiboken6 is needed +- return [shiboken6] ++ # rez-pip patch: Return the path to the shiboken rez package ++ return [os.path.join(os.environ["REZ_SHIBOKEN6_ROOT"], "python", "shiboken6")] ++ + # The below code is for the build process when generate_pyi.py + # is executed in the build directory. We need libpyside and Qt in addition. + shiboken6 = Path(root).parent / 'shiboken6' / 'libshiboken' diff --git a/src/rez_pip/data/patches/pyside6_6_2_4_win_dll_path.patch b/src/rez_pip/data/patches/pyside6_6_2_4_win_dll_path.patch new file mode 100644 index 0000000..9fac2e2 --- /dev/null +++ b/src/rez_pip/data/patches/pyside6_6_2_4_win_dll_path.patch @@ -0,0 +1,20 @@ +--- python/PySide6/__init__.py 2025-01-11 14:43:29.390687962 -0500 ++++ python/PySide6/__init__.py 2025-01-11 15:11:41.569480197 -0500 +@@ -11,14 +11,9 @@ + + + def _additional_dll_directories(package_dir): +- # Find shiboken6 relative to the package directory. +- root = Path(package_dir).parent +- # Check for a flat .zip as deployed by cx_free(PYSIDE-1257) +- if root.suffix == '.zip': +- return [] +- shiboken6 = root / 'shiboken6' +- if shiboken6.is_dir(): # Standard case, only shiboken6 is needed +- return [shiboken6] ++ # rez-pip patch: Return the path to the shiboken rez package ++ return [os.path.join(os.environ["REZ_SHIBOKEN6_ROOT"], "python", "shiboken6")] ++ + # The below code is for the build process when generate_pyi.py + # is executed in the build directory. We need libpyside and Qt in addition. + shiboken6 = Path(root).parent / 'shiboken6' / 'libshiboken' diff --git a/src/rez_pip/data/patches/pyside6_6_3_0_win_dll_path.patch b/src/rez_pip/data/patches/pyside6_6_3_0_win_dll_path.patch new file mode 100644 index 0000000..4744f3c --- /dev/null +++ b/src/rez_pip/data/patches/pyside6_6_3_0_win_dll_path.patch @@ -0,0 +1,20 @@ +--- python/PySide6/__init__.py 2025-01-11 14:43:29.554022310 -0500 ++++ python/PySide6/__init__.py 2025-01-11 15:13:40.307210955 -0500 +@@ -12,14 +12,9 @@ + + + def _additional_dll_directories(package_dir): +- # Find shiboken6 relative to the package directory. +- root = Path(package_dir).parent +- # Check for a flat .zip as deployed by cx_free(PYSIDE-1257) +- if root.suffix == '.zip': +- return [] +- shiboken6 = root / 'shiboken6' +- if shiboken6.is_dir(): # Standard case, only shiboken6 is needed +- return [shiboken6] ++ # rez-pip patch: Return the path to the shiboken rez package ++ return [os.path.join(os.environ["REZ_SHIBOKEN6_ROOT"], "python", "shiboken6")] ++ + # The below code is for the build process when generate_pyi.py + # is executed in the build directory. We need libpyside and Qt in addition. + shiboken6 = Path(root).parent / 'shiboken6' / 'libshiboken' diff --git a/src/rez_pip/plugins/PySide6.py b/src/rez_pip/plugins/PySide6.py index d56cb04..ac76ffe 100644 --- a/src/rez_pip/plugins/PySide6.py +++ b/src/rez_pip/plugins/PySide6.py @@ -7,6 +7,7 @@ import shutil import typing import logging +import platform import packaging.utils import packaging.version @@ -14,6 +15,7 @@ import packaging.requirements import rez_pip.pip +import rez_pip.patch import rez_pip.plugins import rez_pip.exceptions @@ -99,6 +101,56 @@ def groupPackages( return [rez_pip.pip.PackageGroup[rez_pip.pip.PackageInfo](tuple(data))] +@rez_pip.plugins.hookimpl +def patches(dist: "importlib_metadata.Distribution", path: str) -> typing.List[str]: + if dist.name != "PySide6" or platform.system() != "Windows": + return [] + + patches: typing.List[str] = [] + + # To generate the patches: + # 1. run srcipts/get_pyside6_files.py + # 2. Look at the output and get the different diffs. + # 3. Generate a patch for each version range where there is a diff: + # 3.1 cp patches/data/6.3.0/__init__.py patches/data/6.3.0/__init__.py.new + # 3.2 vim patches/data/6.3.0/__init__.py.new + # 3.3 diff --unified patches/data/6.3.0/__init__.py patches/data/6.3.0/__init__.py.new > src/rez_pip/data/patches/pyside6_6_3_0_win_dll_path.patch + # 3.4 Edit src/rez_pip/data/patches/pyside6_6_3_0_win_dll_path.patch to make sure the paths + # are good in the patch header. Also make sure CRLF (line ending) is kept as-is. + # + # I think that it's important that the paths in the look like "python/PySide6/..." + # so that it matches the file layout... + version = packaging.version.Version(dist.version) + if version in packaging.specifiers.SpecifierSet(">=6.0.0,<6.1.0"): + patches.append( + os.path.join( + rez_pip.patch.getBuiltinPatchesDir(), "pyside6_6_0_0_win_dll_path.patch" + ) + ) + + elif version in packaging.specifiers.SpecifierSet(">=6.1.0,<6.2.4"): + patches.append( + os.path.join( + rez_pip.patch.getBuiltinPatchesDir(), "pyside6_6_1_0_win_dll_path.patch" + ) + ) + + elif version in packaging.specifiers.SpecifierSet(">=6.2.4,<6.3.0"): + patches.append( + os.path.join( + rez_pip.patch.getBuiltinPatchesDir(), "pyside6_6_2_4_win_dll_path.patch" + ) + ) + + elif version in packaging.specifiers.SpecifierSet(">=6.3.0"): + patches.append( + os.path.join( + rez_pip.patch.getBuiltinPatchesDir(), "pyside6_6_3_0_win_dll_path.patch" + ) + ) + return patches + + @rez_pip.plugins.hookimpl def cleanup(dist: "importlib_metadata.Distribution", path: str) -> None: if packaging.utils.canonicalize_name(dist.name) not in [