diff options
Diffstat (limited to 'build_scripts/main.py')
-rw-r--r-- | build_scripts/main.py | 76 |
1 files changed, 55 insertions, 21 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py index 887e8e293..142423355 100644 --- a/build_scripts/main.py +++ b/build_scripts/main.py @@ -260,7 +260,7 @@ def prefix(): if virtual_env_name is not None: name = os.path.basename(virtual_env_name) else: - name = "pyside" + name = "qfp" name += str(sys.version_info[0]) if OPTION["DEBUG"]: name += "d" @@ -309,17 +309,6 @@ def prepare_sub_modules(): def prepare_build(): - # Clean up temp build folder. - for n in ["build"]: - d = os.path.join(setup_script_dir, n) - if os.path.isdir(d): - log.info(f"Removing {d}") - try: - rmtree(d) - except Exception as e: - log.warn(f'***** problem removing "{d}"') - log.warn(f'ignored error: {e}') - # locate Qt sources for the documentation if OPTION["QT_SRC"] is None: install_prefix = QtInfo().prefix_dir @@ -413,8 +402,9 @@ class PysideInstallLib(_install_lib): def install(self): """ - Installs files from build/xxx directory into final - site-packages/PySide6 directory. + Installs files from self.build_dir directory into final + site-packages/PySide6 directory when the command is 'install + or into build/wheel when command is 'bdist_wheel'. """ if os.path.isdir(self.build_dir): @@ -537,8 +527,39 @@ class PysideBuild(_build, DistUtilsCommandMixin): script_dir = setup_script_dir sources_dir = os.path.join(script_dir, "sources") - build_dir = os.path.join(script_dir, f"{prefix()}_build", f"{build_name}") - install_dir = os.path.join(script_dir, f"{prefix()}_install", f"{build_name}") + build_base = self.build_base + venv_prefix = prefix() + build_dir = os.path.join(script_dir, build_base, venv_prefix, build_name, "build") + install_dir = os.path.join(script_dir, build_base, venv_prefix, build_name, "install") + setup_tools_build_lib_dir = self.build_lib + + # If setuptools' build_lib was not specified manually (so its + # value was auto-computed which we check by the equality in the + # condition), change its location to the same directory where + # the cmake build and install dirs are so there's + # a common subdirectory for all build-related directories. + # Example: + # Replaces + # build/lib.macosx-10.14-x86_64-3.7' with + # build/py3_mac_qt6_2_03/package-lib.macosx-10.14-x86_64-3.7' + # TODO: Do the same for bdist_dir / bdist_wheel. This will + # require moving the options to be computed in finalize_options. + if self.build_lib == self.build_platlib: + if OPTION["SHORTER_PATHS"]: + # Keep it shorter without the build_platlib suffix. + setup_tools_build_lib_dir = os.path.join(build_base, + venv_prefix, + build_name, + "package") + else: + build_platlib = self.build_platlib + if build_platlib.startswith(build_base): + build_platlib = os.path.basename(build_platlib) + setup_tools_build_lib_dir = os.path.join(build_base, + venv_prefix, + build_name, + f"package-{build_platlib}") + self.build_lib = setup_tools_build_lib_dir self.make_path = make_path self.make_generator = make_generator @@ -627,14 +648,14 @@ class PysideBuild(_build, DistUtilsCommandMixin): log.info(dedent(f""" Building {config.package_name()} will create and touch directories in the following order: - make build directory (py*_build/*/*) -> - make install directory (py*_install/*/*) -> - setuptools build directory (build/*/*) -> + make build directory -> + make install directory -> + setuptools build directory -> setuptools install directory (usually path-installed-python/lib/python*/site-packages/*) """)) - log.info(f"make build directory: {self.build_dir}") - log.info(f"make install directory: {self.install_dir}") + log.info(f"make build directory: {self.build_dir}") + log.info(f"make install directory: {self.install_dir}") log.info(f"setuptools build directory: {self.st_build_dir}") log.info(f"setuptools install directory: {setuptools_install_prefix}") log.info(dedent(f""" @@ -981,6 +1002,19 @@ class PysideBuild(_build, DistUtilsCommandMixin): os.chdir(self.script_dir) + # Clean up the previous st_build_dir before files are copied + # into it again. That's the because the same dir is used + # when copying the files for each of the sub-projects and + # we don't want to accidentally install shiboken files + # as part of pyside-tools package. + if os.path.isdir(self.st_build_dir): + log.info(f"Removing {self.st_build_dir}") + try: + rmtree(self.st_build_dir) + except Exception as e: + log.warn(f'***** problem removing "{self.st_build_dir}"') + log.warn(f'ignored error: {e}') + if sys.platform == "win32": vars['dbg_postfix'] = OPTION["DEBUG"] and "_d" or "" return prepare_packages_win32(self, vars) |