Python sysconfig 模块,get_platform() 实例源码
我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用sysconfig.get_platform()。
def get_build_platform():
"""Return this platform's string for platform-specific distributions
XXX Currently this is the same as ``distutils.util.get_platform()``,but it
needs some hacks for Linux and Mac OS X.
"""
try:
# Python 2.7 or >=3.2
from sysconfig import get_platform
except ImportError:
from distutils.util import get_platform
plat = get_platform()
if sys.platform == "darwin" and not plat.startswith('macosx-'):
try:
version = _macosx_vers()
machine = os.uname()[4].replace(" ", "_")
return "macosx-%d.%d-%s" % (int(version[0]), int(version[1]),
_macosx_arch(machine))
except ValueError:
# if someone is running a non-Mac darwin system,this will fall
# through to the default implementation
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X,we must also kNow the
current version of the OS.
If this condition occurs for any other platform with a version in its
platform strings,this function should be extended accordingly.
"""
plat = get_build_platform()
m = macosversionString.match(plat)
if m is not None and sys.platform == "darwin":
try:
plat = 'macosx-%s-%s' % ('.'.join(_macosx_vers()[:2]), m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
pass # not Mac OS X
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
pass # not Mac OS X
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
pass # not Mac OS X
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
def get_supported_platform():
"""Return this platform's maximum compatible version.
distutils.util.get_platform() normally reports the minimum version
of Mac OS X that would be required to *use* extensions produced by
distutils. But what we want when checking compatibility is to kNow the
version of Mac OS X that we are *running*. To allow usage of packages that
explicitly require a newer version of Mac OS X, m.group(3))
except ValueError:
# not Mac OS X
pass
return plat
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。