def run_setup(self): """ Decide what kind of build is requested and then execute it. In the top-level invocation case, the script will spawn setup.py again (possibly multiple times). In the internal invocation case, the script will run setuptools.setup(). """ # Prepare initial config. config.init_config(build_type=OPTION_BUILD_TYPE, internal_build_type=OPTION_INTERNAL_BUILD_TYPE, cmd_class_dict=cmd_class_dict, package_version=get_package_version(), ext_modules=get_setuptools_extension_modules(), setup_script_dir=self.setup_script_dir, quiet=OPTION_QUIET) # This is an internal invocation of setup.py, so start actual # build. if config.is_internal_invocation(): if config.internal_build_type not in config.get_allowed_internal_build_values( ): raise RuntimeError( "Invalid '{}' option given to --internal-build-type. ". format(config.internal_build_type)) self.run_setuptools_setup() return # This is a top-level invocation of setup.py, so figure out what # modules we will build and depending on that, call setup.py # multiple times with different arguments. if config.build_type not in config.get_allowed_top_level_build_values( ): raise RuntimeError( "Invalid '{}' option given to --build-type. ".format( config.build_type)) # Build everything: shiboken2, shiboken2-generator and PySide2. if config.is_top_level_build_all(): self.add_setup_internal_invocation( config.shiboken_module_option_name) # Reuse the shiboken build for the generator package instead # of rebuilding it again. self.add_setup_internal_invocation( config.shiboken_generator_option_name, reuse_build=True) self.add_setup_internal_invocation(config.pyside_option_name) elif config.is_top_level_build_shiboken_module(): self.add_setup_internal_invocation( config.shiboken_module_option_name) elif config.is_top_level_build_shiboken_generator(): self.add_setup_internal_invocation( config.shiboken_generator_option_name) elif config.is_top_level_build_pyside(): self.add_setup_internal_invocation(config.pyside_option_name) for cmd in self.invocations_list: cmd_as_string = " ".join(cmd) print("\nRunning process: {}\n".format(cmd_as_string)) exit_code = run_process(cmd) if exit_code != 0: msg = textwrap.dedent(""" setup.py invocation failed with exit code: {}.\n\n setup.py invocation was: {} """).format(exit_code, cmd_as_string) raise RuntimeError(msg)
this_file = __file__ except NameError: this_file = sys.argv[0] this_file = os.path.abspath(this_file) if os.path.dirname(this_file): os.chdir(os.path.dirname(this_file)) from build_scripts.main import get_package_version, get_setuptools_extension_modules from build_scripts.main import pyside_package_dir_name from build_scripts.main import cmd_class_dict from build_scripts.main import README, CHANGES from setuptools import setup, Extension # The __version__ variable is just for PEP compliancy, and shouldn't be # used as a value source. __version__ = get_package_version() extension_modules = get_setuptools_extension_modules() setup( name="PySide2", version=get_package_version(), description=("Python bindings for the Qt cross-platform application and " "UI framework"), long_description=README + "\n\n" + CHANGES, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', 'Environment :: MacOS X', 'Environment :: X11 Applications :: Qt', 'Environment :: Win32 (MS Windows)',