def __init__(self, verbose = 0, dry_run = 0, force = 0): CCompiler.__init__(self, verbose, dry_run, force) self.cc = 'bcc32.exe' self.linker = 'ilink32.exe' self.lib = 'tlib.exe' self.preprocess_options = None self.compile_options = ['/tWM', '/O2', '/q', '/g0'] self.compile_options_debug = ['/tWM', '/Od', '/q', '/g0'] self.ldflags_shared = ['/Tpd', '/Gn', '/q', '/x'] self.ldflags_shared_debug = ['/Tpd', '/Gn', '/q', '/x'] self.ldflags_static = [] self.ldflags_exe = ['/Gn', '/q', '/x'] self.ldflags_exe_debug = ['/Gn', '/q', '/x', '/r'] return
def is_flag_supported(flag: str, compiler: CCompiler) -> bool: with tempfile.NamedTemporaryFile('w', suffix='.cpp') as file: file.write('int main(void) { return 0; }') try: compiler.compile([file.name], extra_postargs=[flag]) except CompileError: return False return True
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__(self, verbose, dry_run, force) self.__version = VERSION self.__root = 'Software\\Microsoft\\VisualStudio' self.__paths = [] self.plat_name = None self.__arch = None self.initialized = False
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__(self, verbose, dry_run, force) self.__paths = [] self.__arch = None # deprecated name if os.name == 'nt': if isinstance(self, distutils.msvc9compiler.MSVCCompiler): self.__version = distutils.msvc9compiler.VERSION self.initialized = False self.preprocess_options = None
def __init__(self, verbose = 0, dry_run = 0, force = 0): CCompiler.__init__(self, verbose, dry_run, force) self.__version = VERSION self.__root = 'Software\\Microsoft\\VisualStudio' self.__paths = [] self.plat_name = None self.__arch = None self.initialized = False return
def __init__ (self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) self.__version = get_build_version() if self.__version >= 7: self.__root = r"Software\Microsoft\VisualStudio" self.__macros = MacroExpander(self.__version) else: self.__root = r"Software\Microsoft\Devstudio" self.initialized = False
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__(self, verbose, dry_run, force) self.__version = get_build_version() if self.__version >= 7: self.__root = r"Software\Microsoft\VisualStudio" self.__macros = MacroExpander(self.__version) else: self.__root = r"Software\Microsoft\Devstudio" self.initialized = False
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) self.__version = VERSION self.__root = r"Software\Microsoft\VisualStudio" # self.__macros = MACROS self.__paths = [] # target platform (.plat_name is consistent with 'bdist') self.plat_name = None self.__arch = None # deprecated name self.initialized = False
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__(self, verbose, dry_run, force) self.__version = VERSION self.__root = r"Software\Microsoft\VisualStudio" # self.__macros = MACROS self.__paths = [] # target platform (.plat_name is consistent with 'bdist') self.plat_name = None self.__arch = None # deprecated name self.initialized = False
def has_flag(compiler: CCompiler, value: str) -> bool: """Detects whether a flag name is supported on the specified compiler.""" with tempfile.NamedTemporaryFile('w', suffix='.cpp') as file: file.write('int main (int argc, char **argv) { return 0; }') try: compiler.compile([file.name], extra_postargs=[value]) except CompileError: return False return True
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) if VERSION < 8.0: raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION) self.__version = VERSION self.__root = r"Software\Microsoft\VisualStudio" # self.__macros = MACROS self.__paths = [] # target platform (.plat_name is consistent with 'bdist') self.plat_name = None self.__arch = None # deprecated name self.initialized = False
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__(self, verbose, dry_run, force) self.cc = 'bcc32.exe' self.linker = 'ilink32.exe' self.lib = 'tlib.exe' self.preprocess_options = None self.compile_options = ['/tWM', '/O2', '/q', '/g0'] self.compile_options_debug = ['/tWM', '/Od', '/q', '/g0'] self.ldflags_shared = ['/Tpd', '/Gn', '/q', '/x'] self.ldflags_shared_debug = ['/Tpd', '/Gn', '/q', '/x'] self.ldflags_static = [] self.ldflags_exe = ['/Gn', '/q', '/x'] self.ldflags_exe_debug = ['/Gn', '/q', '/x', '/r']
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__(self, verbose, dry_run, force) self.__version = get_build_version() self.__arch = get_build_architecture() if self.__arch == "Intel": if self.__version >= 7: self.__root = "Software\\Microsoft\\VisualStudio" self.__macros = MacroExpander(self.__version) else: self.__root = "Software\\Microsoft\\Devstudio" self.__product = "Visual Studio version %s" % self.__version else: self.__product = "Microsoft SDK compiler %s" % (self.__version + 6) self.initialized = False
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__(self, verbose, dry_run, force) self.__version = get_build_version() self.__arch = get_build_architecture() if self.__arch == 'Intel': if self.__version >= 7: self.__root = 'Software\\Microsoft\\VisualStudio' self.__macros = MacroExpander(self.__version) else: self.__root = 'Software\\Microsoft\\Devstudio' self.__product = 'Visual Studio version %s' % self.__version else: self.__product = 'Microsoft SDK compiler %s' % (self.__version + 6) self.initialized = False
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__(self, verbose, dry_run, force) self.__version = get_build_version() self.__arch = get_build_architecture() if self.__arch == "Intel": # x86 if self.__version >= 7: self.__root = r"Software\Microsoft\VisualStudio" self.__macros = MacroExpander(self.__version) else: self.__root = r"Software\Microsoft\Devstudio" self.__product = "Visual Studio version %s" % self.__version else: # Win64. Assume this was built with the platform SDK self.__product = "Microsoft SDK compiler %s" % (self.__version + 6) self.initialized = False
def __init__ (self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) self.__version = get_build_version() self.__arch = get_build_architecture() if self.__arch == "Intel": # x86 if self.__version >= 7: self.__root = r"Software\Microsoft\VisualStudio" self.__macros = MacroExpander(self.__version) else: self.__root = r"Software\Microsoft\Devstudio" self.__product = "Visual Studio version %s" % self.__version else: # Win64. Assume this was built with the platform SDK self.__product = "Microsoft SDK compiler %s" % (self.__version + 6) self.initialized = False
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__(self, verbose, dry_run, force) self.__version = get_build_version() if self.__version >= 7: self.__root = r"Software\Microsoft\VisualStudio" self.__macros = MacroExpander(self.__version) else: self.__root = r"Software\Microsoft\Devstudio" self.__paths = self.get_msvc_paths("path") if len(self.__paths) == 0: raise DistutilsPlatformError, \ ("Python was built with version %s of Visual Studio, " "and extensions need to be built with the same " "version of the compiler, but it isn't installed." % self.__version) self.cc = self.find_exe("cl.exe") self.linker = self.find_exe("link.exe") self.lib = self.find_exe("lib.exe") self.rc = self.find_exe("rc.exe") # resource compiler self.mc = self.find_exe("mc.exe") # message compiler self.set_path_env_var('lib') self.set_path_env_var('include') # extend the MSVC path with the current path try: for p in string.split(os.environ['path'], ';'): self.__paths.append(p) except KeyError: pass os.environ['path'] = string.join(self.__paths, ';') self.preprocess_options = None self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GX', '/DNDEBUG' ] self.compile_options_debug = [ '/nologo', '/Od', '/MDd', '/W3', '/GX', '/Z7', '/D_DEBUG' ] self.ldflags_shared = ['/DLL', '/nologo', '/INCREMENTAL:NO'] self.ldflags_shared_debug = [ '/DLL', '/nologo', '/INCREMENTAL:no', '/pdb:None', '/DEBUG' ] self.ldflags_static = ['/nologo']
def _fix_lib_args(self, libraries, library_dirs, runtime_library_dirs): """Remove standard library path from rpath""" libraries, library_dirs, runtime_library_dirs = \ CCompiler._fix_lib_args(self, libraries, library_dirs, runtime_library_dirs) libdir = sysconfig.get_config_var('LIBDIR') if runtime_library_dirs and (libdir in runtime_library_dirs): runtime_library_dirs.remove(libdir) return libraries, library_dirs, runtime_library_dirs
def __init__ (self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) self.__version = get_build_version() if self.__version >= 7: self.__root = r"Software\Microsoft\VisualStudio" self.__macros = MacroExpander(self.__version) else: self.__root = r"Software\Microsoft\Devstudio" self.__paths = self.get_msvc_paths("path") if len (self.__paths) == 0: raise DistutilsPlatformError, \ ("Python was built with version %s of Visual Studio, " "and extensions need to be built with the same " "version of the compiler, but it isn't installed." % self.__version) self.cc = self.find_exe("cl.exe") self.linker = self.find_exe("link.exe") self.lib = self.find_exe("lib.exe") self.rc = self.find_exe("rc.exe") # resource compiler self.mc = self.find_exe("mc.exe") # message compiler self.set_path_env_var('lib') self.set_path_env_var('include') # extend the MSVC path with the current path try: for p in string.split(os.environ['path'], ';'): self.__paths.append(p) except KeyError: pass os.environ['path'] = string.join(self.__paths, ';') self.preprocess_options = None self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GX' , '/DNDEBUG'] self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GX', '/Z7', '/D_DEBUG'] self.ldflags_shared = ['/DLL', '/nologo', '/INCREMENTAL:NO'] self.ldflags_shared_debug = [ '/DLL', '/nologo', '/INCREMENTAL:no', '/pdb:None', '/DEBUG' ] self.ldflags_static = [ '/nologo']
def _fix_lib_args(self, libraries, library_dirs, runtime_library_dirs): # we need to have this method here, to avoid an endless # recursion in UnixCCompiler._fix_lib_args. libraries, library_dirs, runtime_library_dirs = \ CCompiler._fix_lib_args(self, libraries, library_dirs, runtime_library_dirs) libdir = sysconfig.get_config_var('LIBDIR') if runtime_library_dirs and (libdir in runtime_library_dirs): runtime_library_dirs.remove(libdir) return libraries, library_dirs, runtime_library_dirs
def __init__ (self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) versions = get_devstudio_versions () if versions: version = versions[0] # highest version self.cc = find_exe("cl.exe", version) self.linker = find_exe("link.exe", version) self.lib = find_exe("lib.exe", version) self.rc = find_exe("rc.exe", version) # resource compiler self.mc = find_exe("mc.exe", version) # message compiler set_path_env_var ('lib', version) set_path_env_var ('include', version) path=get_msvc_paths('path', version) try: for p in string.split(os.environ['path'],';'): path.append(p) except KeyError: pass os.environ['path'] = string.join(path,';') else: # devstudio not found in the registry self.cc = "cl.exe" self.linker = "link.exe" self.lib = "lib.exe" self.rc = "rc.exe" self.mc = "mc.exe" self.preprocess_options = None self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GX' ] self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', '/GX', '/Z7', '/D_DEBUG'] self.ldflags_shared = ['/DLL', '/nologo', '/INCREMENTAL:NO'] self.ldflags_shared_debug = [ '/DLL', '/nologo', '/INCREMENTAL:no', '/pdb:None', '/DEBUG' ] self.ldflags_static = [ '/nologo']
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__(self, verbose, dry_run, force) # These executables are assumed to all be in the path. # Borland doesn't seem to use any special registry settings to # indicate their installation locations. self.cc = "bcc32.exe" self.link = "ilink32.exe" self.lib = "tlib.exe" self.preprocess_options = None self.compile_options = ['/tWM', '/O2', '/q', '/g0'] self.compile_options_debug = ['/tWM', '/Od', '/q', '/g0'] self.ldflags_shared = ['/Tpd', '/Gn', '/q', '/x'] self.ldflags_shared_debug = ['/Tpd', '/Gn', '/q', '/x'] self.ldflags_static = []
def __init__(self, verbose=0, dry_run=0, force=0): super(distutils.msvccompiler.MSVCCompiler, self).__init__() CCompiler.__init__(self, verbose, dry_run, force) self.__paths = [] self.__arch = None # deprecated name if os.name == 'nt': if isinstance(self, distutils.msvc9compiler.MSVCCompiler): self.__version = distutils.msvc9compiler.VERSION self.initialized = False self.preprocess_options = None if self.check_is_clang_cl(): cc_cmd = os.environ.get('CC').split() self.cc = cc_cmd[0] self.linker = 'lld-link' self.compile_options = [] # Add any arguments added to clang-cl to self.compile_options # such as cross-compilation flags if len(cc_cmd) > 1: self.compile_options.extend(cc_cmd[1:]) self.initialized = True
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__(self, verbose, dry_run, force) # These executables are assumed to all be in the path. # Borland doesn't seem to use any special registry settings to # indicate their installation locations. self.cc = "bcc32.exe" self.linker = "ilink32.exe" self.lib = "tlib.exe" self.preprocess_options = None self.compile_options = ["/tWM", "/O2", "/q", "/g0"] self.compile_options_debug = ["/tWM", "/Od", "/q", "/g0"] self.ldflags_shared = ["/Tpd", "/Gn", "/q", "/x"] self.ldflags_shared_debug = ["/Tpd", "/Gn", "/q", "/x"] self.ldflags_static = [] self.ldflags_exe = ["/Gn", "/q", "/x"] self.ldflags_exe_debug = ["/Gn", "/q", "/x", "/r"]
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__(self, verbose, dry_run, force) versions = get_devstudio_versions() if versions: version = versions[0] # highest version self.cc = find_exe("cl.exe", version) self.linker = find_exe("link.exe", version) self.lib = find_exe("lib.exe", version) self.rc = find_exe("rc.exe", version) # resource compiler self.mc = find_exe("mc.exe", version) # message compiler set_path_env_var("lib", version) set_path_env_var("include", version) path = get_msvc_paths("path", version) try: for p in string.split(os.environ["path"], ";"): path.append(p) except KeyError: pass os.environ["path"] = string.join(path, ";") else: # devstudio not found in the registry self.cc = "cl.exe" self.linker = "link.exe" self.lib = "lib.exe" self.rc = "rc.exe" self.mc = "mc.exe" self.preprocess_options = None self.compile_options = ["/nologo", "/Ox", "/MD", "/W3", "/GX"] self.compile_options_debug = ["/nologo", "/Od", "/MDd", "/W3", "/GX", "/Z7", "/D_DEBUG"] self.ldflags_shared = ["/DLL", "/nologo", "/INCREMENTAL:NO"] self.ldflags_shared_debug = ["/DLL", "/nologo", "/INCREMENTAL:no", "/pdb:None", "/DEBUG"] self.ldflags_static = ["/nologo"]
def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra_postargs): macros, objects, extra_postargs, pp_opts, build = \ CCompiler._setup_compile(self, outdir, macros, incdirs, [], depends, extra_postargs) if incdirs is None: incdirs = self.include_dirs else: incdirs = list(incdirs) + (self.include_dirs or []) if depends is None: depends = set() else: depends = set(depends) # Get the list of expected output files objects = self.object_filenames(sources, strip_dir=0, output_dir=outdir) # Do dependency checking skip_source = set() if self.force: # rebuild everything pass else: for src, obj in izip(sources, objects): deps = _find_depends(src, incdirs, depends) deps.add(src) if not newer_group(deps, obj): skip_source.add(src) build = {} for src, obj in izip(sources, objects): self.mkpath(os.path.dirname(obj)) if src in skip_source: log.debug("skipping %s (%s up-to-date)", src, obj) else: build[obj] = src, os.path.splitext(src)[1] return macros, objects, extra_postargs, pp_opts, build
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) # target platform (.plat_name is consistent with 'bdist') self.plat_name = None self.initialized = False
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__(self, verbose, dry_run, force) self.plat_name = None self.initialized = False
"""distutils.mwerkscompiler
"""distutils.bcppcompiler
"""distutils.unixccompiler
def __init__(self, verbose=0, dry_run=0, force=0): CCompiler.__init__(self, verbose, dry_run, force)
def spawn(self, cmd): env = dict(os.environ, PATH=self._paths) return CCompiler.spawn(self, cmd, env=env)
def __init__ (self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force)