def main(argv): """Create the configuration module module. argv is the list of command line arguments. """ siputils.inform("This is SIP %s for Python %s on %s." % (sip_version_str, sys.version.split()[0], sys.platform)) global py_version, build_platform if py_version < 0x020300: siputils.error("This version of SIP requires Python v2.3 or later.") # Basic initialisation. set_platform_directories() set_build_platform() # Build up the list of valid specs. for s in os.listdir(os.path.join(src_dir, "specs")): platform_specs.append(s) # Determine the directory containing the default OS/X SDK. if sys.platform == 'darwin': for sdk_dir in MACOSX_SDK_DIRS: if os.path.isdir(sdk_dir): break else: sdk_dir = MACOSX_SDK_DIRS[0] else: sdk_dir = '' # Parse the command line. global opts p = create_optparser(sdk_dir) opts, args = p.parse_args() # Override defaults that affect subsequent configuration. if opts.target_py_version is not None: py_version = opts.target_py_version if opts.sysroot is not None: global sysroot sysroot = opts.sysroot # Make sure MacOS specific options get initialised. if sys.platform != 'darwin': opts.universal = '' opts.arch = [] opts.sdk = '' opts.deployment_target = '' # Handle the query options. if opts.show_platforms or opts.show_build_macros: if opts.show_platforms: show_platforms() if opts.show_build_macros: show_macros() sys.exit() # Convert the list 'arch' option to a string. Multiple architectures # imply a universal binary. if len(opts.arch) > 1: opts.universal = True opts.arch = ' '.join(opts.arch) # Convert the boolean 'universal' option to a string. if opts.universal: if '/' in opts.sdk: opts.universal = os.path.abspath(opts.sdk) else: opts.universal = sdk_dir + '/' + opts.sdk if not os.path.isdir(opts.universal): siputils.error( "Unable to find the SDK directory %s. Use the --sdk flag to specify the name of the SDK or its full path." % opts.universal) if opts.arch == '': opts.arch = DEFAULT_MACOSX_ARCH else: opts.universal = '' # Apply the overrides from any configuration file. global plat_bin_dir, plat_py_conf_inc_dir, plat_py_inc_dir global plat_py_lib_dir, plat_py_site_dir, plat_sip_dir global sip_bin_dir, sip_inc_dir, sip_module_dir, sip_sip_dir # Set defaults. sip_bin_dir = plat_bin_dir sip_inc_dir = plat_py_inc_dir sip_module_dir = plat_py_site_dir sip_sip_dir = plat_sip_dir if opts.config_file is not None: update_from_configuration_file(opts.config_file) elif sysroot != '': def apply_sysroot(d): if d.startswith(sys.prefix): d = sysroot + d[len(sys.prefix):] return d plat_bin_dir = apply_sysroot(plat_bin_dir) plat_py_conf_inc_dir = apply_sysroot(plat_py_conf_inc_dir) plat_py_inc_dir = apply_sysroot(plat_py_inc_dir) plat_py_lib_dir = apply_sysroot(plat_py_lib_dir) plat_py_site_dir = apply_sysroot(plat_py_site_dir) plat_sip_dir = apply_sysroot(plat_sip_dir) sip_bin_dir = apply_sysroot(sip_bin_dir) sip_inc_dir = apply_sysroot(sip_inc_dir) sip_module_dir = apply_sysroot(sip_module_dir) sip_sip_dir = apply_sysroot(sip_sip_dir) # Override from the command line. if opts.platform is not None: build_platform = opts.platform if opts.sipbindir is not None: sip_bin_dir = opts.sipbindir if opts.sipincdir is not None: sip_inc_dir = opts.sipincdir if opts.sipmoddir is not None: sip_module_dir = opts.sipmoddir if opts.sipsipdir is not None: sip_sip_dir = opts.sipsipdir # Get the platform specific macros for building. macros = siputils.parse_build_macros( os.path.join(src_dir, "specs", build_platform), build_macro_names, args) if macros is None: siputils.error( "Unsupported macro name specified. Use the --show-build-macros flag to see a list of supported macros." ) sys.exit(2) # Fix the name of the sip module. global sip_module_base module_path = opts.sip_module.split(".") sip_module_base = module_path[-1] if len(module_path) > 1: del module_path[-1] module_path.insert(0, sip_module_dir) sip_module_dir = os.path.join(*module_path) # Tell the user what's been found. inform_user() # Patch any files that need it. patch_files() # Install the configuration module. create_config("sipconfig.py", os.path.join(src_dir, "siputils.py"), macros) # Create the Makefiles. create_makefiles(macros)
def main(argv): """Create the configuration module module. argv is the list of command line arguments. """ siputils.inform("This is SIP %s for Python %s on %s." % (sip_version_str, sys.version.split()[0], sys.platform)) if py_version < 0x020300: siputils.error("This version of SIP requires Python v2.3 or later.") # Basic initialisation. set_platform_directories() # Build up the list of valid specs. for s in os.listdir("specs"): platform_specs.append(s) # Parse the command line. global opts set_defaults() p = create_optparser() print argv opts, args = p.parse_args(argv[1:]) # Handle the query options. if opts.show_platforms or opts.show_build_macros: if opts.show_platforms: show_platforms() if opts.show_build_macros: show_macros() sys.exit() # Convert the boolean 'universal' option to a string. if opts.universal: if '/' in opts.sdk: opts.universal = os.path.abspath(opts.sdk) else: opts.universal = '/Developer/SDKs/' + opts.sdk if not os.path.isdir(opts.universal): siputils.error("Unable to find the SDK directory %s. Use the -s flag to specify the name of the SDK (e.g. %s) or its full path." % (opts.universal, DEFAULT_MACOSX_SDK)) else: opts.universal = '' # Get the platform specific macros for building. macros = siputils.parse_build_macros(os.path.join("specs", opts.platform), build_macro_names, args) if macros is None: p.print_help() sys.exit(2) # Tell the user what's been found. inform_user() # Install the configuration module. create_config("sipconfig.py", "siputils.py", macros) # Create the Makefiles. create_makefiles(macros)
def main(argv): """Create the configuration module module. argv is the list of command line arguments. """ siputils.inform("This is SIP %s for Python %s on %s." % (sip_version_str, sys.version.split()[0], sys.platform)) if py_version < 0x020300: siputils.error("This version of SIP requires Python v2.3 or later.") # Basic initialisation. set_platform_directories() # Build up the list of valid specs. for s in os.listdir(os.path.join(src_dir, "specs")): platform_specs.append(s) # Parse the command line. global opts set_defaults() p = create_optparser() opts, args = p.parse_args() # Make sure MacOS specific options get initialised. if sys.platform != 'darwin': opts.universal = '' opts.arch = [] opts.sdk = '' # Handle the query options. if opts.show_platforms or opts.show_build_macros: if opts.show_platforms: show_platforms() if opts.show_build_macros: show_macros() sys.exit() # Convert the list 'arch' option to a string. Multiple architectures # imply a universal binary. if len(opts.arch) > 1: opts.universal = True opts.arch = ' '.join(opts.arch) # Convert the boolean 'universal' option to a string. if opts.universal: if '/' in opts.sdk: opts.universal = os.path.abspath(opts.sdk) else: opts.universal = MACOSX_SDK_DIR + '/' + opts.sdk if not os.path.isdir(opts.universal): siputils.error("Unable to find the SDK directory %s. Use the --sdk flag to specify the name of the SDK or its full path." % opts.universal) if opts.arch == '': opts.arch = DEFAULT_MACOSX_ARCH else: opts.universal = '' # Get the platform specific macros for building. macros = siputils.parse_build_macros( os.path.join(src_dir, "specs", opts.platform), build_macro_names, args) if macros is None: p.print_help() sys.exit(2) # Tell the user what's been found. inform_user() # Install the configuration module. create_config("sipconfig.py", os.path.join(src_dir, "siputils.py"), macros) # Create the Makefiles. create_makefiles(macros)
def main(argv): """Create the configuration module module. argv is the list of command line arguments. """ siputils.inform("This is SIP %s for Python %s on %s." % (sip_version_str, sys.version.split()[0], sys.platform)) global py_version, build_platform if py_version < 0x020300: siputils.error("This version of SIP requires Python v2.3 or later.") # Basic initialisation. set_platform_directories() set_build_platform() # Build up the list of valid specs. for s in os.listdir(os.path.join(src_dir, "specs")): platform_specs.append(s) # Determine the directory containing the default OS/X SDK. if sys.platform == "darwin": for sdk_dir in MACOSX_SDK_DIRS: if os.path.isdir(sdk_dir): break else: sdk_dir = MACOSX_SDK_DIRS[0] else: sdk_dir = "" # Parse the command line. global opts p = create_optparser(sdk_dir) opts, args = p.parse_args() # Override defaults that affect subsequent configuration. if opts.target_py_version is not None: py_version = opts.target_py_version if opts.sysroot is not None: global sysroot sysroot = opts.sysroot # Make sure MacOS specific options get initialised. if sys.platform != "darwin": opts.universal = "" opts.arch = [] opts.sdk = "" opts.deployment_target = "" # Handle the query options. if opts.show_platforms or opts.show_build_macros: if opts.show_platforms: show_platforms() if opts.show_build_macros: show_macros() sys.exit() # Convert the list 'arch' option to a string. Multiple architectures # imply a universal binary. if len(opts.arch) > 1: opts.universal = True opts.arch = " ".join(opts.arch) # Convert the boolean 'universal' option to a string. if opts.universal: if "/" in opts.sdk: opts.universal = os.path.abspath(opts.sdk) else: opts.universal = sdk_dir + "/" + opts.sdk if not os.path.isdir(opts.universal): siputils.error( "Unable to find the SDK directory %s. Use the --sdk flag to specify the name of the SDK or its full path." % opts.universal ) if opts.arch == "": opts.arch = DEFAULT_MACOSX_ARCH else: opts.universal = "" # Apply the overrides from any configuration file. global plat_bin_dir, plat_py_conf_inc_dir, plat_py_inc_dir global plat_py_lib_dir, plat_py_site_dir, plat_sip_dir global sip_bin_dir, sip_inc_dir, sip_module_dir, sip_sip_dir # Set defaults. sip_bin_dir = plat_bin_dir sip_inc_dir = plat_py_venv_inc_dir sip_module_dir = plat_py_site_dir sip_sip_dir = plat_sip_dir if opts.config_file is not None: update_from_configuration_file(opts.config_file) elif sysroot != "": def apply_sysroot(d): if d.startswith(sys.prefix): d = sysroot + d[len(sys.prefix) :] return d plat_bin_dir = apply_sysroot(plat_bin_dir) plat_py_conf_inc_dir = apply_sysroot(plat_py_conf_inc_dir) plat_py_inc_dir = apply_sysroot(plat_py_inc_dir) plat_py_lib_dir = apply_sysroot(plat_py_lib_dir) plat_py_site_dir = apply_sysroot(plat_py_site_dir) plat_sip_dir = apply_sysroot(plat_sip_dir) sip_bin_dir = apply_sysroot(sip_bin_dir) sip_inc_dir = apply_sysroot(sip_inc_dir) sip_module_dir = apply_sysroot(sip_module_dir) sip_sip_dir = apply_sysroot(sip_sip_dir) # Override from the command line. if opts.platform is not None: build_platform = opts.platform if opts.sipbindir is not None: sip_bin_dir = opts.sipbindir if opts.sipincdir is not None: sip_inc_dir = opts.sipincdir if opts.sipmoddir is not None: sip_module_dir = opts.sipmoddir if opts.sipsipdir is not None: sip_sip_dir = opts.sipsipdir # Get the platform specific macros for building. macros = siputils.parse_build_macros(os.path.join(src_dir, "specs", build_platform), build_macro_names, args) if macros is None: siputils.error( "Unsupported macro name specified. Use the --show-build-macros flag to see a list of supported macros." ) sys.exit(2) # Fix the name of the sip module. global sip_module_base module_path = opts.sip_module.split(".") sip_module_base = module_path[-1] if len(module_path) > 1: del module_path[-1] module_path.insert(0, sip_module_dir) sip_module_dir = os.path.join(*module_path) # Tell the user what's been found. inform_user() # Patch any files that need it. patch_files() # Install the configuration module. create_config("sipconfig.py", os.path.join(src_dir, "siputils.py"), macros) # Create the Makefiles. create_makefiles(macros)