From c83e15fe6a52b2ce484f1e41f8306df2e5de1c7c Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Mon, 21 Oct 2024 18:17:09 +0200 Subject: setup: fix PySide6.__all__ after the wheel split, amendment 2 When trying to write a module.__all__ variable without interference with different runtime folders, this version uses the __getattr__ support that Python 3.7 has introduced. This creates the __all__ variable on demand, when someone accesses that variable, for instance by "from PySide6 import *" which is the intended use. amends 703d975f16aff95bc9014a2689a3ae824b5a552f. Task-number: PYSIDE-1890 Change-Id: Ia4ead5bc7e499573d534ec7237b27ee737590a91 Fixes: PYSIDE-2895 Reviewed-by: Cristian Maureira-Fredes (cherry picked from commit a27a9bf413288cbadf64188fe9a8a3fc6a6f1b9c) --- build_scripts/main.py | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'build_scripts/main.py') diff --git a/build_scripts/main.py b/build_scripts/main.py index cad754c4c..a7d837aaf 100644 --- a/build_scripts/main.py +++ b/build_scripts/main.py @@ -59,20 +59,6 @@ def elapsed(): return int(time.time() - start_time) -def _fix_pyside_init_py(path): - """For reproducible builds, strip out the part that contains the build-directory - from PySide's __init__.py (PYSIDE-2895/QTBUG-105926).""" - START_MARKER = "\n # Note: We should _not_ call this function" - END_MARKER = "return __all__\n" - contents = path.read_text(encoding='utf-8') - start = contents.find(START_MARKER) - end = contents.find(END_MARKER, start + len(START_MARKER)) if start != -1 else -1 - if end == -1: - raise SetupError(f"Unable to fix {path}") - fixed_contents = contents[:start] + contents[end + len(END_MARKER):] - path.write_text(fixed_contents, encoding='utf-8') - - def get_setuptools_extension_modules(): # Setting py_limited_api on the extension is the "correct" thing # to do, but it doesn't actually do anything, because we @@ -481,9 +467,6 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): log.warning(f'problem renaming "{self.st_build_dir}"') log.warning(f'ignored error: {type(e).__name__}: {e}') - if config.is_internal_pyside_build(): - _fix_pyside_init_py(_dst / "__init__.py") - else: log.info("Skipped preparing and building packages.") log.info(f"--- Build completed ({elapsed()}s)") -- cgit v1.2.3