Python distutils.command.build_ext.build_ext 模块,build_extension() 实例源码

我们从Python开源项目中,提取了以下24个代码示例,用于说明如何使用distutils.command.build_ext.build_ext.build_extension()

项目:PyMiniRacer    作者:sqreen    | 项目源码 | 文件源码
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))
项目:deb-python-cassandra-driver    作者:openstack    | 项目源码 | 文件源码
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)
项目:deb-python-cassandra-driver    作者:openstack    | 项目源码 | 文件源码
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,))
项目:yarl    作者:aio-libs    | 项目源码 | 文件源码
def build_extension(self, ext):
        try:
            build_ext.build_extension(self, ext)
        except (CCompilerError, DistutilsExecError,
                DistutilsPlatformError, ValueError):
            raise BuildFailed()
项目:cbor_py    作者:brianolson    | 项目源码 | 文件源码
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
项目:apm-agent-python    作者:elastic    | 项目源码 | 文件源码
def build_extension(self, ext):
        try:
            build_ext.build_extension(self, ext)
        except build_ext_errors:
            raise BuildExtFailed()
项目:backpack    作者:sdispater    | 项目源码 | 文件源码
def build_extension(self, ext):
        try:
            build_ext.build_extension(self, ext)
        except build_ext_errors:
            raise BuildExtFailed()
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def build_extension(self, ext):
        try:
            build_ext.build_extension(self, ext)
        except ext_errors:
            raise BuildFailed()
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
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]))
项目:pendulum    作者:sdispater    | 项目源码 | 文件源码
def build_extension(self, ext):
        try:
            build_ext.build_extension(self, ext)
        except (CCompilerError, DistutilsExecError,
                DistutilsPlatformError, ValueError):
            raise BuildFailed()
项目:ms_deisotope    作者:mobiusklein    | 项目源码 | 文件源码
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
项目:deb-python-wrapt    作者:openstack    | 项目源码 | 文件源码
def build_extension(self, ext):
        try:
            build_ext.build_extension(self, ext)
        except build_ext_errors:
            raise BuildExtFailed()
项目:multidict    作者:aio-libs    | 项目源码 | 文件源码
def build_extension(self, ext):
        try:
            build_ext.build_extension(self, ext)
        except (CCompilerError, DistutilsExecError,
                DistutilsPlatformError, ValueError):
            raise BuildFailed()
项目:annotated-py-tornado    作者:hhstore    | 项目源码 | 文件源码
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."))
项目:deb-msgpack-python    作者:openstack    | 项目源码 | 文件源码
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)
项目:influxgraph    作者:InfluxGraph    | 项目源码 | 文件源码
def build_extension(self, ext):
        try:
            build_ext.build_extension(self, ext)
        except ext_errors:
            raise BuildFailed()
项目:aredis    作者:NoneGG    | 项目源码 | 文件源码
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."))
项目:aweasome_learning    作者:Knight-ZXW    | 项目源码 | 文件源码
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."))
项目:durotar    作者:markgao    | 项目源码 | 文件源码
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."))
项目:browser_vuln_check    作者:lcatro    | 项目源码 | 文件源码
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."))
项目:solaris-ips    作者:oracle    | 项目源码 | 文件源码
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
项目:python-dse-driver    作者:datastax    | 项目源码 | 文件源码
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)
项目:python-dse-driver    作者:datastax    | 项目源码 | 文件源码
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,))
项目:ProgrameFacil    作者:Gpzim98    | 项目源码 | 文件源码
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."))