當前位置: 首頁>>代碼示例>>Python>>正文


Python distutils.msvccompiler方法代碼示例

本文整理匯總了Python中distutils.msvccompiler方法的典型用法代碼示例。如果您正苦於以下問題:Python distutils.msvccompiler方法的具體用法?Python distutils.msvccompiler怎麽用?Python distutils.msvccompiler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在distutils的用法示例。


在下文中一共展示了distutils.msvccompiler方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: prevent_msvc_compiling_patch

# 需要導入模塊: import distutils [as 別名]
# 或者: from distutils import msvccompiler [as 別名]
def prevent_msvc_compiling_patch():  # type: ignore
        import distutils
        import distutils._msvccompiler
        import distutils.msvc9compiler
        import distutils.msvccompiler

        from distutils.errors import CompileError

        def raise_compile_error(*args, **kwargs):  # type: ignore
            raise CompileError('Chalice blocked C extension compiling.')
        distutils._msvccompiler.MSVCCompiler.compile = raise_compile_error
        distutils.msvc9compiler.MSVCCompiler.compile = raise_compile_error
        distutils.msvccompiler.MSVCCompiler.compile = raise_compile_error

    # This is the setuptools shim used to execute setup.py by pip.
    # Lines 2 and 3 have been added to call the above function
    # `prevent_msvc_compiling_patch` and extra escapes have been added on line
    # 5 because it is passed through another layer of string parsing before it
    # is executed. 
開發者ID:aws,項目名稱:chalice,代碼行數:21,代碼來源:compat.py

示例2: get_build_architecture

# 需要導入模塊: import distutils [as 別名]
# 或者: from distutils import msvccompiler [as 別名]
def get_build_architecture():
    # Importing distutils.msvccompiler triggers a warning on non-Windows
    # systems, so delay the import to here.
    from distutils.msvccompiler import get_build_architecture
    return get_build_architecture() 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:7,代碼來源:misc_util.py

示例3: get_build_architecture

# 需要導入模塊: import distutils [as 別名]
# 或者: from distutils import msvccompiler [as 別名]
def get_build_architecture():
        from distutils.msvccompiler import get_build_architecture
        return get_build_architecture() 
開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:5,代碼來源:misc_util.py

示例4: msvc_exists

# 需要導入模塊: import distutils [as 別名]
# 或者: from distutils import msvccompiler [as 別名]
def msvc_exists():
    """ Determine whether MSVC is available on the machine.
    """
    result = 0
    try:
        p = subprocess.Popen(['cl'], shell=True,
                stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
        str_result = p.stdout.read()
        if 'Microsoft' in str_result:
            result = 1
    except:
        #assume we're ok if devstudio exists
        import distutils.msvccompiler

        # There was a change to 'distutils.msvccompiler' between Python 2.2
        # and Python 2.3.
        #
        # In Python 2.2 the function is 'get_devstudio_versions'
        # In Python 2.3 the function is 'get_build_version'
        try:
            version = distutils.msvccompiler.get_devstudio_versions()

        except:
            version = distutils.msvccompiler.get_build_version()

        if version:
            result = 1
    return result 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:30,代碼來源:platform_info.py

示例5: get_exe_bytes

# 需要導入模塊: import distutils [as 別名]
# 或者: from distutils import msvccompiler [as 別名]
def get_exe_bytes (self):
        from distutils.msvccompiler import get_build_version
        # If a target-version other than the current version has been
        # specified, then using the MSVC version from *this* build is no good.
        # Without actually finding and executing the target version and parsing
        # its sys.version, we just hard-code our knowledge of old versions.
        # NOTE: Possible alternative is to allow "--target-version" to
        # specify a Python executable rather than a simple version string.
        # We can then execute this program to obtain any info we need, such
        # as the real sys.version string for the build.
        cur_version = get_python_version()
        if self.target_version and self.target_version != cur_version:
            if self.target_version < "2.3":
                raise NotImplementedError
            elif self.target_version == "2.3":
               bv = "6"
            elif self.target_version in ("2.4", "2.5"):
               bv = "7.1"
            elif self.target_version in ("2.6", "2.7"):
                bv = "9.0"
            else:
                raise NotImplementedError
        else:
            # for current version - use authoritative check.
            bv = get_build_version()

        # wininst-x.y.exe is in the same directory as this file
        directory = os.path.dirname(__file__)
        # we must use a wininst-x.y.exe built with the same C compiler
        # used for python.  XXX What about mingw, borland, and so on?

        # The uninstallers need to be available in $PYEXT_CROSS/uninst/*.exe
        # Use http://oss.itsystementwicklung.de/hg/pyext_cross_linux_to_win32/
        # and copy it alongside your pysqlite checkout.

        filename = os.path.join(directory, os.path.join(os.environ["PYEXT_CROSS"], "uninst", "wininst-%s.exe" % bv))
        return open(filename, "rb").read()
# class bdist_wininst 
開發者ID:plasticityai,項目名稱:magnitude,代碼行數:40,代碼來源:cross_bdist_wininst.py

示例6: get_exe_bytes

# 需要導入模塊: import distutils [as 別名]
# 或者: from distutils import msvccompiler [as 別名]
def get_exe_bytes (self):
        from distutils.msvccompiler import get_build_version
        # If a target-version other than the current version has been
        # specified, then using the MSVC version from *this* build is no good.
        # Without actually finding and executing the target version and parsing
        # its sys.version, we just hard-code our knowledge of old versions.
        # NOTE: Possible alternative is to allow "--target-version" to
        # specify a Python executable rather than a simple version string.
        # We can then execute this program to obtain any info we need, such
        # as the real sys.version string for the build.
        cur_version = get_python_version()
        if self.target_version and self.target_version != cur_version:
            # If the target version is *later* than us, then we assume they
            # use what we use
            # string compares seem wrong, but are what sysconfig.py itself uses
            if self.target_version > cur_version:
                bv = get_build_version()
            else:
                if self.target_version < "2.4":
                    bv = "6"
                else:
                    bv = "7.1"
        else:
            # for current version - use authoritative check.
            bv = get_build_version()

        # wininst-x.y.exe is in the same directory as this file
        directory = os.path.dirname(__file__)
        # we must use a wininst-x.y.exe built with the same C compiler
        # used for python.  XXX What about mingw, borland, and so on?
        filename = os.path.join(directory, "wininst-%s.exe" % bv)
        return open(filename, "rb").read()
# class bdist_wininst 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:35,代碼來源:bdist_wininst.py

示例7: get_exe_bytes

# 需要導入模塊: import distutils [as 別名]
# 或者: from distutils import msvccompiler [as 別名]
def get_exe_bytes (self):
        from distutils.msvccompiler import get_build_version
        # If a target-version other than the current version has been
        # specified, then using the MSVC version from *this* build is no good.
        # Without actually finding and executing the target version and parsing
        # its sys.version, we just hard-code our knowledge of old versions.
        # NOTE: Possible alternative is to allow "--target-version" to
        # specify a Python executable rather than a simple version string.
        # We can then execute this program to obtain any info we need, such
        # as the real sys.version string for the build.
        cur_version = get_python_version()
        if self.target_version and self.target_version != cur_version:
            # If the target version is *later* than us, then we assume they
            # use what we use
            # string compares seem wrong, but are what sysconfig.py itself uses
            if self.target_version > cur_version:
                bv = get_build_version()
            else:
                if self.target_version < "2.4":
                    bv = 6.0
                else:
                    bv = 7.1
        else:
            # for current version - use authoritative check.
            bv = get_build_version()

        # wininst-x.y.exe is in the same directory as this file
        directory = os.path.dirname(__file__)
        # we must use a wininst-x.y.exe built with the same C compiler
        # used for python.  XXX What about mingw, borland, and so on?

        # if plat_name starts with "win" but is not "win32"
        # we want to strip "win" and leave the rest (e.g. -amd64)
        # for all other cases, we don't want any suffix
        if self.plat_name != 'win32' and self.plat_name[:3] == 'win':
            sfix = self.plat_name[3:]
        else:
            sfix = ''

        filename = os.path.join(directory, "wininst-%.1f%s.exe" % (bv, sfix))
        f = open(filename, "rb")
        try:
            return f.read()
        finally:
            f.close()
# class bdist_wininst 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:48,代碼來源:bdist_wininst.py

示例8: get_exe_bytes

# 需要導入模塊: import distutils [as 別名]
# 或者: from distutils import msvccompiler [as 別名]
def get_exe_bytes(self):
        from distutils.msvccompiler import get_build_version
        # If a target-version other than the current version has been
        # specified, then using the MSVC version from *this* build is no good.
        # Without actually finding and executing the target version and parsing
        # its sys.version, we just hard-code our knowledge of old versions.
        # NOTE: Possible alternative is to allow "--target-version" to
        # specify a Python executable rather than a simple version string.
        # We can then execute this program to obtain any info we need, such
        # as the real sys.version string for the build.
        cur_version = get_python_version()
        if self.target_version and self.target_version != cur_version:
            # If the target version is *later* than us, then we assume they
            # use what we use
            # string compares seem wrong, but are what sysconfig.py itself uses
            if self.target_version > cur_version:
                bv = get_build_version()
            else:
                if self.target_version < "2.4":
                    bv = 6.0
                else:
                    bv = 7.1
        else:
            # for current version - use authoritative check.
            bv = get_build_version()

        # wininst-x.y.exe is in the same directory as this file
        directory = os.path.dirname(__file__)
        # we must use a wininst-x.y.exe built with the same C compiler
        # used for python.  XXX What about mingw, borland, and so on?

        # if plat_name starts with "win" but is not "win32"
        # we want to strip "win" and leave the rest (e.g. -amd64)
        # for all other cases, we don't want any suffix
        if self.plat_name != 'win32' and self.plat_name[:3] == 'win':
            sfix = self.plat_name[3:]
        else:
            sfix = ''

        filename = os.path.join(directory, "wininst-%.1f%s.exe" % (bv, sfix))
        f = open(filename, "rb")
        try:
            return f.read()
        finally:
            f.close() 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:47,代碼來源:bdist_wininst.py


注:本文中的distutils.msvccompiler方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。