我们从Python开源项目中,提取了以下24个代码示例,用于说明如何使用distutils.command.build_ext.build_ext.build_extension()。
def build_extension(self, ext): """ Compile manually the py_mini_racer extension, bypass setuptools """ try: if not is_v8_built(): self.run_command('build_v8') self.debug = True if V8_PATH: dest_filename = join(self.build_lib, "py_mini_racer") copy_file(V8_PATH, dest_filename, verbose=self.verbose, dry_run=self.dry_run) else: build_ext.build_extension(self, ext) except Exception as e: # Alter message err_msg = """py_mini_racer failed to build, ensure you have an up-to-date pip (>= 8.1) to use the wheel instead To update pip: 'pip install -U pip' See also: https://github.com/sqreen/PyMiniRacer#binary-builds-availability Original error: %s""" raise Exception(err_msg % repr(e))
def build_extensions(self): if build_concurrency > 1: self.check_extensions_list(self.extensions) import multiprocessing.pool multiprocessing.pool.ThreadPool(processes=build_concurrency).map(self.build_extension, self.extensions) else: build_ext.build_extensions(self)
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, DistutilsPlatformError, ValueError): raise BuildFailed()
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except build_errors as be: raise BuildError(be) except ValueError as ve: # this can happen on Windows 64 bit, see Python issue 7511 if "'path'" in str(sys.exc_info()[1]): # works with Python 2 and 3 raise BuildError(ve) raise
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except build_ext_errors: raise BuildExtFailed()
def build_extension(self, ext): try: build_ext.build_extension(self, ext) except ext_errors: raise BuildFailed()
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, ext): try: build_ext.build_extension(self, ext) except ext_errors: traceback.print_exc() raise BuildFailed() except ValueError: # this can happen on Windows 64 bit, see Python issue 7511 traceback.print_exc() if "'path'" in str(sys.exc_info()[1]): # works with both py 2/3 raise BuildFailed() raise
def build_extension(self, ext): name = ext.name try: build_ext.build_extension(self, ext) except Exception: 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."))
def build_extension(self, ext): try: ext.sources = list(map(ensure_source, ext.sources)) except NoCython: print("WARNING") print("Cython is required for building extension from checkout.") print("Install Cython >= 0.16 or install msgpack from PyPI.") print("Falling back to pure Python implementation.") return try: return build_ext.build_extension(self, ext) except Exception as e: print("WARNING: Failed to compile extension modules.") print("msgpack uses fallback pure python implementation.") print(e)
def build_extension(self, ext): name = ext.name try: build_ext.build_extension(self, ext) except Exception: 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."))
def build_extension(self, ext): # Build 32-bit self.build_temp = str(self.build_temp) _build_ext.build_extension(self, ext) if not ext.build_64: return # Set up for 64-bit old_build_temp = self.build_temp d, f = os.path.split(self.build_temp) # store our 64-bit extensions elsewhere self.build_temp = str(d + "/temp64.{0}".format( os.path.basename(self.build_temp).replace("temp.", ""))) ext.extra_compile_args += ["-m64"] ext.extra_link_args += ["-m64"] self.build64 = True # Build 64-bit _build_ext.build_extension(self, ext) # Reset to 32-bit self.build_temp = str(old_build_temp) ext.extra_compile_args.remove("-m64") ext.extra_link_args.remove("-m64") self.build64 = False