diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | build_scripts/main.py | 15 | ||||
-rw-r--r-- | build_scripts/options.py | 15 | ||||
-rw-r--r-- | sources/pyside6/cmake/Macros/PySideModules.cmake | 2 |
4 files changed, 21 insertions, 13 deletions
@@ -113,6 +113,8 @@ using `setup.py build`: or macOS only). * `--verbose-build`, will output the compiler invocation with command line arguments, etc. + * `--disable-pyi`, will suppress the generation of .pyi files. This allows + debugging when the project builds but the pyi generator complains. ## Requirements diff --git a/build_scripts/main.py b/build_scripts/main.py index f60d55176..8d81108f3 100644 --- a/build_scripts/main.py +++ b/build_scripts/main.py @@ -692,12 +692,14 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): "(default yes if applicable, i.e. Python " "version >= 3.8 and release build if on Windows)") + if OPTION["DISABLE_PYI"]: + cmake_cmd.append("-DDISABLE_PYI=yes") + if OPTION["LOG_LEVEL"] == LogLevel.VERBOSE: cmake_cmd.append("-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON") else: cmake_cmd.append("-DCMAKE_VERBOSE_MAKEFILE:BOOL=OFF") - if OPTION['COMPILER_LAUNCHER']: compiler_launcher = OPTION['COMPILER_LAUNCHER'] cmake_cmd.append(f"-DCMAKE_C_COMPILER_LAUNCHER={compiler_launcher}") @@ -856,8 +858,7 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): if OPTION["LOG_LEVEL"] == LogLevel.VERBOSE and self.make_generator == "Ninja": make_doc_cmd.append("-v") if run_process(make_doc_cmd) != 0: - raise SetupError("Error generating documentation " - f"for {extension}") + raise SetupError(f"Error generating documentation for {extension}") else: log.info("Sphinx not found, skipping documentation build") else: @@ -1003,8 +1004,8 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): # (lib/libclang.lib), whereas we want to copy the shared # library (bin/libclang.dll). clang_lib_path = Path(re.sub(r'lib/libclang.lib$', - 'bin/libclang.dll', - clang_lib_path)) + 'bin/libclang.dll', + clang_lib_path)) else: clang_lib_path = Path(clang_lib_path) # shiboken6 links against libclang.so.6 or a similarly @@ -1092,6 +1093,7 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): message = "Patched rpath to '$ORIGIN/' in" if sys.platform.startswith('linux'): + def rpath_cmd(srcpath): final_rpath = '' # Command line rpath option takes precedence over @@ -1110,6 +1112,7 @@ class PysideBuild(_build, CommandMixin, BuildInfoCollectorMixin): elif sys.platform == 'darwin': message = "Updated rpath in" + def rpath_cmd(srcpath): final_rpath = '' # Command line rpath option takes precedence over @@ -1279,7 +1282,7 @@ class PysideBaseDocs(Command, CommandMixin): if self.name == PYSIDE: self.sphinx_src = self.out_dir / "base" example_gallery = config.setup_script_dir / "tools" / "example_gallery" / "main.py" - assert(example_gallery.is_file()) + assert example_gallery.is_file() example_gallery_cmd = [sys.executable, os.fspath(example_gallery)] if OPTION["LOG_LEVEL"] == LogLevel.QUIET: example_gallery_cmd.append("--quiet") diff --git a/build_scripts/options.py b/build_scripts/options.py index 59b9a3ffc..d42b1514f 100644 --- a/build_scripts/options.py +++ b/build_scripts/options.py @@ -24,6 +24,7 @@ Additional options: --cmake-toolchain-file Path to CMake toolchain to enable cross-compiling --shiboken-host-path Path to host shiboken package when cross-compiling --qt-host-path Path to host Qt installation when cross-compiling + --disable-pyi Disable .pyi file generation """ @@ -122,7 +123,8 @@ def _jobs_option_value(): def find_qtpaths(): # for these command --qtpaths should not be required - no_qtpaths_commands = ["--help", "--help-commands", "--qt-target-path", "build_base_docs", "build_rst_docs"] + no_qtpaths_commands = ["--help", "--help-commands", "--qt-target-path", "build_base_docs", + "build_rst_docs"] for no_qtpaths_command in no_qtpaths_commands: if any(no_qtpaths_command in argument for argument in sys.argv): @@ -159,6 +161,7 @@ OPTION = { "VERBOSE_BUILD": has_option('verbose-build'), "SNAPSHOT_BUILD": has_option("snapshot-build"), "LIMITED_API": option_value("limited-api"), + "DISABLE_PYI": has_option("disable-pyi"), "PACKAGE_TIMESTAMP": option_value("package-timestamp"), # This is used automatically by setuptools.command.install object, to # specify the final installation location. @@ -442,8 +445,8 @@ class CommandMixin(object): # qtpaths is available. This happens when building the host # tools in the overall cross-building process. use_cmake = False - if (using_cmake_toolchain_file or - (not self.qmake and not self.qtpaths and self.qt_target_path)): + if (using_cmake_toolchain_file or (not self.qmake + and not self.qtpaths and self.qt_target_path)): use_cmake = True QtInfo().setup(qtpaths_abs_path, self.cmake, qmake_abs_path, @@ -542,9 +545,9 @@ class CommandMixin(object): # while cross-compiling. # Skip this process for the 'build_base_docs' command if (not self.is_cross_compile - and not self.qt_target_path - and 'build_base_docs' not in sys.argv - and 'build_rst_docs' not in sys.argv): + and not self.qt_target_path + and 'build_base_docs' not in sys.argv + and 'build_rst_docs' not in sys.argv): # Enforce usage of qmake in QtInfo if it was given explicitly. if self.qmake: self.has_qmake_option = True diff --git a/sources/pyside6/cmake/Macros/PySideModules.cmake b/sources/pyside6/cmake/Macros/PySideModules.cmake index a54f529f9..bf6054a76 100644 --- a/sources/pyside6/cmake/Macros/PySideModules.cmake +++ b/sources/pyside6/cmake/Macros/PySideModules.cmake @@ -280,7 +280,7 @@ macro(create_pyside_module) # Don't generate the files when cross-building because the target python can not be executed # on the host machine (usually, unless you use some userspace qemu based mechanism). # TODO: Can we do something better here to still get pyi files? - if(NOT PYSIDE_IS_CROSS_BUILD) + if(NOT (PYSIDE_IS_CROSS_BUILD OR DISABLE_PYI)) set(generate_pyi_options ${module_NAME} --sys-path "${pysidebindings_BINARY_DIR}" "${SHIBOKEN_PYTHON_MODULE_DIR}/..") # use the layer above shiboken6 |