def build_extension(self, ext): try: build_ext.build_extension(self, ext) except build_errors: warn(self.warning_message % ("The %s extension module" % ext.name, "Above is the ouput showing how " "the compilation failed."))
def build_extension(self, ext): if self.amalgamation: get_amalgamation() # build with fulltext search enabled ext.define_macros.append( ("SQLITE_ENABLE_FTS3", "1")) ext.define_macros.append( ("SQLITE_ENABLE_RTREE", "1")) # SQLCipher options ext.define_macros.append( ("SQLITE_ENABLE_LOAD_EXTENSION", "1")) ext.define_macros.append( ("SQLITE_HAS_CODEC", "1")) ext.define_macros.append( ("SQLITE_TEMP_STORE", "2")) ext.sources.append(os.path.join(AMALGAMATION_ROOT, "sqlite3.c")) ext.include_dirs.append(AMALGAMATION_ROOT) ext.extra_link_args.append("-lcrypto") if self.static: self._build_extension(ext) else: build_ext.build_extension(self, ext)
def build_extension (self, extension): _build_ext.build_extension (self, extension) if not self.inplace and os.name == 'posix': filename = self.get_ext_filename (extension.name) link_filename = filename target_filename = os.path.join (self.build_lib, filename) recursion_scan = os.path.split (filename) [0] if hasattr (os, 'symlink'): if ( os.path.islink (link_filename) and os.path.realpath (link_filename) == os.path.abspath (target_filename)): return while recursion_scan: recursion_scan = os.path.split (recursion_scan) [0] target_filename = os.path.join (os.pardir, target_filename) try: os.remove (link_filename) except: # Ignore all errors. pass if hasattr (os, 'symlink'): try: os.symlink (target_filename, link_filename) except: # Ignore all errors. pass else: # FIXME: Copy the library then. pass
def build_extension(self,ext): # command-line arguments prevail over extension arguments # but if no command-line argument is defined,extension argument is # taken into account self.__ext=ext build_ext.build_extension(self,ext) if(os.name!='posix'): # Copy the .lib file fullname = self.get_ext_fullname(ext.name) modpath = string.split(fullname, '.') package = string.join(modpath[0:-1], '.') base = modpath[-1] if self.inplace: # ignore build-lib -- put the compiled extension into # the source tree along with pure Python modules build_py = self.get_finalized_command('build_py') package_dir = build_py.get_package_dir(package) dstLib=package_dir else: dstLib=self.build_lib srcLib=os.path.join(self.build_temp,base+".lib") dstLib=os.path.join(dstLib,package) copy_file(srcLib,dstLib)
def build_extension(self, ext): if self.amalgamation: get_amalgamation() ext.define_macros.append(("SQLITE_ENABLE_FTS3", "1")) # build with fulltext search enabled ext.sources.append(os.path.join(AMALGAMATION_ROOT, "sqlite3.c")) ext.include_dirs.append(AMALGAMATION_ROOT) build_ext.build_extension(self, ext)
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except CCompilerError, x: print ("*" * 70 + "\n") print BUILD_EXT_WARNING print ("*" * 70 + "\n")
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except (CCompilerError, DistutilsError), why: self.announce('WARNING: building of extension "%s" failed: %s' % (ext.name, sys.exc_info()[1]))
def build_extension(self, extension): build_ext.build_extension(self, extension) sysVer = sys.version_info[:2] # For Python versions that use MSVC compiler 2008, re-insert the # manifest into the resulting .pyd file. if self.compiler_is_msvc() and sysVer == (2, 7): platform = get_platform() # Default to the x86 manifest manifest = '_psycopg.vc9.x86.manifest' if platform == 'win-amd64': manifest = '_psycopg.vc9.amd64.manifest' try: ext_path = self.get_ext_fullpath(extension.name) except AttributeError: ext_path = os.path.join(self.build_lib, 'psycopg2', '_psycopg.pyd') # Make sure spawn() will work if compile() was never # called. https://github.com/psycopg/psycopg2/issues/380 if not self.compiler.initialized: self.compiler.initialize() self.compiler.spawn( ['mt.exe', '-nologo', '-manifest', os.path.join('psycopg', manifest), '-outputresource:%s;2' % ext_path])
def build_extension(self, ext): self.with_mt = ENABLE_MULTITHREADING if self.with_mt and not sys.platform in mt_platforms: warn("""\ Multithreading is not supported on the platform "%s", please contact [email protected] for more informations.""" % (sys.platform), UnsupportedPlatformWarning) self.with_mt = False if self.with_mt: log.info('adding support for multithreaded compression') ext.define_macros.append(('COMPRESS_MF_MT', 1)) ext.sources += ( 'src/sdk/C/LzFindMt.c', 'src/sdk/C/MtCoder.c', 'src/sdk/C/MtDec.c', 'src/sdk/C/Threads.c', ) else: ext.define_macros.append(('_7ZIP_ST', 1)) if isinstance(self.compiler, MSVCCompiler): # set flags only available when using MSVC ext.extra_link_args.append('/MANIFEST') if COMPILE_DEBUG: ext.extra_compile_args.append('/Zi') ext.extra_compile_args.append('/MTd') ext.extra_link_args.append('/DEBUG') else: ext.extra_compile_args.append('/MT') _build_ext.build_extension(self, ext)
def build_extension(self, ext): # only preprocess with esql if necessary fullname = self.get_ext_fullname(ext.name) ext_filename = os.path.join(self.build_lib, self.get_ext_filename(fullname)) if not (self.force or newer_group(ext.sources, ext_filename, 'newer')): self.announce("skipping '%s' extension (up-to-date)" % ext.name) return # preprocess *.ec files with 'esql' for file in ext.sources: if file.endswith('.ec'): dir = os.path.dirname(file) f = os.path.basename(file) cmd = ' '.join(self.esql_parts + [ '-e', f ]) print cmd curdir = os.getcwd() os.chdir(dir) os.system(cmd) os.chdir(curdir) ext.sources[ext.sources.index(file)] = file[:-3]+'.c' _build_ext.build_extension(self, ext)
def build_extension(self, ext): name = ext.name if sys.version_info[:3] >= (2, 4, 0): try: build_ext.build_extension(self, ext) if should_run_tests(): self.set_nose_options() except build_errors: e = sys.exc_info()[1] sys.stdout.write("%s\n" % str(e)) warnings.warn( self.warning_message % ( "The %s extension " "module" % (name,), "The output above " "this warning shows how " "the compilation " "failed.", ) ) else: warnings.warn( self.warning_message % ( "The %s extension " "module" % (name,), "Please use Python >= 2.4 " "to take advantage of the " "extension.", ) )
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except (CCompilerError, DistutilsExecError, DistutilsPlatformError, ValueError): print("************************************************************") print("Cannot compile C accelerator module, use pure python version") print("************************************************************")
def build_extension(self, ext): # work around linker problem with MacPython 2.3 if sys.platform == 'darwin': try: self.compiler.linker_so.remove("-Wl,-x") except: pass # work around linker problem with Linux, Python 2.2 and earlier: # despite setting $CC above, still uses Python compiler if sys.platform == 'linux2': try: ext.libraries.append("stdc++") except: pass if ext.name == "Mk4py": if isinstance(self.compiler, MSVCCompiler): suffix = '.obj' if self.debug: prefix = '../builds/msvc60/mklib/Debug/' else: prefix = '../builds/msvc60/mklib/Release/' else: suffix = '.o' prefix = '../builds/' for i in range(len(ext.extra_objects)): nm = ext.extra_objects[i] if nm in mkobjs: if string.find(nm, '.') == -1: nm = nm + suffix nm = prefix + nm ext.extra_objects[i] = nm build_ext.build_extension(self, ext)
def build_extension(self, ext): self.with_mt = ENABLE_MULTITHREADING if self.with_mt and not sys.platform in mt_platforms: warn( """\ Multithreading is not supported on the platform "%s", please contact [email protected] for more informations.""" % (sys.platform), UnsupportedPlatformWarning, ) self.with_mt = False if self.with_mt: log.info("adding support for multithreaded compression") ext.define_macros.append(("COMPRESS_MF_MT", 1)) ext.sources += ("src/sdk/LzFindMt.c", "src/sdk/Threads.c") if isinstance(self.compiler, MSVCCompiler): # set flags only available when using MSVC if COMPILE_DEBUG: ext.extra_compile_args.append("/Zi") ext.extra_compile_args.append("/MTd") ext.extra_link_args.append("/DEBUG") else: ext.extra_compile_args.append("/MT") _build_ext.build_extension(self, ext)
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except CCompilerError, x: print ('*'*70+'\n') print BUILD_EXT_WARNING print ('*'*70+'\n')
def build_extension(self, ext): if ext.language == "c++": try: self.compiler.compiler_so.remove("-Wstrict-prototypes") except Exception: pass _build_ext.build_extension(self, ext)
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except CCompilerError: if getattr(ext, 'optional', False): raise log.warn("Failed to build optional extension '%s' (skipping)", ext.name)
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except CCompilerError: if not hasattr(ext, 'optional') or not ext.optional: raise log.warn("Failed to build optional extension '%s' (skipping)", ext.name)
def build_extension(self, ext): try: build_ext.build_extension(self, ext) global _speedup_available _speedup_available = True except CCompilerError: _etype, e, _tb = sys.exc_info() self._unavailable(e)
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except (CCompilerError, DistutilsExecError, DistutilsPlatformError, IOError) as exc: sys.stderr.write('%s\n' % str(exc)) name = "The %s extension" % (ext.name,) warnings.warn(self.error_message % (name,))
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except (CCompilerError, DistutilsExecError): # The sys.exc_info()[1] is to preserve compatibility with both # Python 2.5 and 3.x, which is needed in setup.py. self._unavailable(sys.exc_info()[1])
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except (CCompilerError, DistutilsExecError, DistutilsPlatformError, IOError): ex = sys.exc_info()[1] sys.stdout.write('%s\n' % str(ex)) warnings.warn("Extension module %s: The output above this warning shows how the compilation failed." % ext.name)
def build_extension(self, ext): if isinstance(ext, CudaExtension): log.info("pre-building '%s' CudaExtension using nvcc", ext.name) compiler = CudaCompiler() objects = compiler.compile(ext.cuda_sources, output_dir=self.build_temp, extra_postargs=ext.cuda_extra_compile_args) ext.extra_objects += objects build_ext.build_extension(self, ext)
def build_extension(self, ext): global enable_pcre if enable_pcre: ext.extra_compile_args.append('-DENABLE_PCRE') ext.libraries=['pcre'] ext.extra_compile_args.append('-Wall') ext.extra_compile_args.append('-DVERSION=%s' % version) build_ext.build_extension(self, ext)
def build_extension(self, ext): # Skip extensions which cannot be built try: build_ext.build_extension(self, ext) except: self.announce( '*** WARNING: Building of extension "%s" ' 'failed: %s' % (ext.name, sys.exc_info()[1]))
def build_extension(self, ext): # extra_compile_args if "extra_compile_args" in self.pyev_options: extra_compile_args = self.pyev_options["extra_compile_args"] if ext.extra_compile_args: ext.extra_compile_args.extend(extra_compile_args) else: ext.extra_compile_args = extra_compile_args build_ext.build_extension(self, ext)
def build_pyqt_extension(self, ext): self.configure(ext) self.announce("Switching to the compiler for Qt extensions.") self.compiler, self.qt_compiler = self.qt_compiler, self.compiler old_build_ext.build_extension(self, ext) self.announce("Switching to the compiler for vanilla extensions.") self.compiler, self.qt_compiler = self.qt_compiler, self.compiler
def build_extension(self,ext): build_ext.build_extension(self,ext) ext_src = self.get_ext_fullpath(ext.name) ext_dest = self.get_ext_filename(ext.name) try: os.unlink(ext_dest) except: pass os.chmod(ext_src,0755) print 'copying %s to %s' % (ext_src,ext_dest) copy2(ext_src,ext_dest)
def build_extension(self, ext): try: _build_ext.build_extension(self, ext) # Record the names of extensions which were successful, trim '_' self.builtsolvernames.append(ext.name[1:]) except CCompilerError: self.failedsolvernames.append(ext.name[1:])
def build_extension(self, ext): if sys.version_info[:3] >= (2, 4, 0): try: build_ext.build_extension(self, ext) except build_errors, e: print e print self.warning_message % ("The %s extension module" % ext.name, "Above is the ouput showing how " "the compilation failed.")
def build_extension(self, ext): customize_for_platform(ext, self.compiler.compiler_type) build_ext.build_extension(self, ext)
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except ignore_compile_excs: raise BuildFailed()
def build_extension(self, ext): if isinstance(ext, StaticLibrary): self.build_static_extension(ext) else: _build_ext.build_extension(self, ext)
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except (CCompilerError, DistutilsExecError, DistutilsPlatformError, ValueError): raise BuildFailed()
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except (CCompilerError, DistutilsExecError), x: self._unavailable(x)
def build_extension(self, ext): if self.enable_openmp: ext.extra_compile_args.append('-fopenmp') ext.extra_link_args.append('-fopenmp') _build_ext.build_extension(self, ext)
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except ext_errors: log.info('cannot bulid C extension, will continue without.')
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except ext_errors: raise BuildFailed()
def build_extension(self, ext): build_ext.build_extension(self, ext)
def build_extension(self, ext): # We override this instead of setting extra_compile_args directly on # the Extension() instantiations below because we want to use the same # logic to resolve the location of gdal-config throughout. ext.extra_compile_args.extend(self.extra_cflags) return build_ext.build_extension(self, ext)
def build_extension(self, ext): build_ext.build_extension(self, ext) ext_path = self.get_ext_fullpath(ext.name) patch_lib_paths(ext_path, self.compiler.library_dirs)
def build_extension(self, ext): ext.sources = list(map(ensure_source, ext.sources)) return build_ext.build_extension(self, ext)
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except build_ext_errors as e: print("WARNING: Failed to build extension %s, skipping: %s" % (ext.name, e))
def build_extension(self, ext): self.run_command('build_v8') distutils_build_ext.build_extension(self, ext)
def build_extension(self, ext): log.info(self.description) build_ext.build_extension(self, ext)
def build_extension(self, ext): if _is_using_gcc(self): if "-std=c99" not in ext.extra_compile_args: ext.extra_compile_args.append("-std=c99") build_ext.build_extension(self, ext)
def build_extension(self, extension): # generate files python/gen/*.c, python/gen/aubio-generated.h extension.sources += generate_external(header, output_path, overwrite=False) return _build_ext.build_extension(self, extension)
def build_extension(self, ext): if ext.name == '_ctypes': if not self.configure_ctypes(ext): return try: build_ext.build_extension(self, ext) except (CCompilerError, DistutilsError) as why: self.announce('WARNING: building of extension "%s" failed: %s' % (ext.name, sys.exc_info()[1])) self.failed.append(ext.name) return # Workaround for Mac OS X: The Carbon-based modules cannot be # reliably imported into a command-line Python if 'Carbon' in ext.extra_link_args: self.announce( 'WARNING: skipping import check for Carbon-based "%s"' % ext.name) return if host_platform == 'darwin' and (sys.maxsize > 2**32 and '-arch' in ext.extra_link_args): # Don't bother doing an import check when an extension was # build with an explicit '-arch' flag on OSX. That's currently # only used to build 32-bit only extensions in a 4-way # universal build and loading 32-bit code into a 64-bit # process will fail. self.announce('WARNING: skipping import check for "%s"' % ext.name) return # Workaround for Cygwin: Cygwin currently has fork issues when many # modules have been imported if host_platform == 'cygwin': self.announce( 'WARNING: skipping import check for Cygwin-based "%s"' % ext.name) return ext_filename = os.path.join( self.build_lib, self.get_ext_filename(self.get_ext_fullname(ext.name))) # If the build directory didn't exist when setup.py was # started, sys.path_importer_cache has a negative result # cached. Clear that cache before trying to import. sys.path_importer_cache.clear() # Don't try to load extensions for cross builds if cross_compiling: return try: imp.load_dynamic(ext.name, ext_filename) except ImportError as why: self.failed.append(ext.name) self.announce('*** WARNING: renaming "%s" since importing it' ' failed: %s' % (ext.name, why), level=3) assert not self.inplace basename, tail = os.path.splitext(ext_filename) newname = basename + "_failed" + tail if os.path.exists(newname): os.remove(newname) os.rename(ext_filename, newname) # XXX -- This relies on a Vile HACK in # distutils.command.build_ext.build_extension(). The # _built_objects attribute is stored there strictly for # use here. # If there is a failure, _built_objects may not be there, # so catch the AttributeError and move on. try: for filename in self._built_objects: os.remove(filename) except AttributeError: self.announce('unable to remove files (ignored)') except: exc_type, why, tb = sys.exc_info() self.announce('*** WARNING: importing extension "%s" ' 'failed with %s: %s' % (ext.name, exc_type, why), level=3) self.failed.append(ext.name)
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except: None
def build_extension(self, ext): """ Builds the .pyd file using msbuild or xbuild. """ if ext.name != "clr": return build_ext.build_extension(self, ext) # install packages using nuget self._install_packages() dest_file = self.get_ext_fullpath(ext.name) dest_dir = os.path.dirname(dest_file) if not os.path.exists(dest_dir): os.makedirs(dest_dir) # Up to Python 3.2 sys.maxunicode is used to determine the size of Py_UNICODE # but from 3.3 onwards Py_UNICODE is a typedef of wchar_t. if sys.version_info[:2] <= (3, 2): unicode_width = 2 if sys.maxunicode < 0x10FFFF else 4 else: import ctypes unicode_width = ctypes.sizeof(ctypes.c_wchar) defines = [ "PYTHON%d%s" % (sys.version_info[:2]), "UCS%d" % unicode_width, ] if CONFIG == "Debug": defines.extend(["DEBUG", "TRACE"]) if sys.platform != "win32" and DEVTOOLS == "Mono": if sys.platform == "darwin": defines.append("MONO_OSX") else: defines.append("MONO_LINUX") # Check if --enable-shared was set when Python was built enable_shared = get_config_var("Py_ENABLE_SHARED") if enable_shared == 0: defines.append("PYTHON_WITHOUT_ENABLE_SHARED") if hasattr(sys, "abiflags"): if "d" in sys.abiflags: defines.append("PYTHON_WITH_PYDEBUG") if "m" in sys.abiflags: defines.append("PYTHON_WITH_PYMALLOC") if "u" in sys.abiflags: defines.append("PYTHON_WITH_WIDE_UNICODE") # check the interop file exists, and create it if it doesn't interop_file = _get_interop_filename() if not os.path.exists(interop_file): geninterop = os.path.join("tools", "geninterop", "geninterop.py") _check_output([sys.executable, geninterop, interop_file]) cmd = [ _xbuild, "pythonnet.sln", "/p:Configuration=%s" % _config, "/p:Platform=%s" % PLATFORM, "/p:DefineConstants=\"%s\"" % _defines_sep.join(defines), "/p:PythonBuildDir=\"%s\"" % os.path.abspath(dest_dir), "/p:PythonInteropFile=\"%s\"" % os.path.basename(interop_file), "/verbosity:%s" % VERBOSITY, ] manifest = self._get_manifest(dest_dir) if manifest: cmd.append("/p:PythonManifest=\"%s\"" % manifest) self.announce("Building: %s" % " ".join(cmd)) use_shell = True if DEVTOOLS == "Mono" else False check_call(" ".join(cmd + ["/t:Clean"]), shell=use_shell) check_call(" ".join(cmd + ["/t:Build"]), shell=use_shell) if DEVTOOLS == "Mono": self._build_monoclr(ext)
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except (CCompilerError, DistutilsExecError), x: raise BuildFailed()
def build_extension(self, ext): if ext.name == 'pida.ui.moo_stub': subprocess.check_call(['make', 'prepare'], cwd=os.path.join(os.path.dirname(__file__),'contrib/moo') ) build_ext.build_extension(self, ext)
def build_extension(self, ext): if self.use_cpp_0x: ext.extra_compile_args += ['-std=c++0x'] ext.define_macros += [('PYTANGO_HAS_UNIQUE_PTR', '1')] dftbuild_ext.build_extension(self, ext)
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except CCompilerError, x: self._unavailable()
def build_extension(self, ext): self._ctypes = isinstance(ext, CTypes) return build_ext.build_extension(self, ext)
def build_extension(self, ext): ext.extra_compile_args = ['-O2']+get_cflags().split() return _build_ext.build_extension(self, ext)