本文整理匯總了Python中distutils.command.install.SCHEME_KEYS屬性的典型用法代碼示例。如果您正苦於以下問題:Python install.SCHEME_KEYS屬性的具體用法?Python install.SCHEME_KEYS怎麽用?Python install.SCHEME_KEYS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類distutils.command.install
的用法示例。
在下文中一共展示了install.SCHEME_KEYS屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_install_paths
# 需要導入模塊: from distutils.command import install [as 別名]
# 或者: from distutils.command.install import SCHEME_KEYS [as 別名]
def get_install_paths(name):
"""
Return the (distutils) install paths for the named dist.
A dict with ('purelib', 'platlib', 'headers', 'scripts', 'data') keys.
"""
paths = {}
i = get_install_command(name)
for key in install.SCHEME_KEYS:
paths[key] = getattr(i, 'install_' + key)
# pip uses a similar path as an alternative to the system's (read-only)
# include directory:
if hasattr(sys, 'real_prefix'): # virtualenv
paths['headers'] = os.path.join(sys.prefix,
'include',
'site',
'python' + sys.version[:3],
name)
return paths
示例2: get_install_paths
# 需要導入模塊: from distutils.command import install [as 別名]
# 或者: from distutils.command.install import SCHEME_KEYS [as 別名]
def get_install_paths(name):
"""
Return the (distutils) install paths for the named dist.
A dict with ('purelib', 'platlib', 'headers', 'scripts', 'data') keys.
"""
paths = {}
i = get_install_command(name)
for key in install.SCHEME_KEYS:
paths[key] = getattr(i, 'install_' + key)
# pip uses a similar path as an alternative to the system's (read-only)
# include directory:
if hasattr(sys, 'real_prefix'): # virtualenv
paths['headers'] = os.path.join(sys.prefix,
'include',
'site',
'python' + sys.version[:3],
name)
return paths
示例3: select_scheme
# 需要導入模塊: from distutils.command import install [as 別名]
# 或者: from distutils.command.install import SCHEME_KEYS [as 別名]
def select_scheme(self, name):
"""Sets the install directories by applying the install schemes."""
# it's the caller's problem if they supply a bad name!
scheme = INSTALL_SCHEMES[name]
for key in SCHEME_KEYS:
attrname = 'install_' + key
if getattr(self, attrname) is None:
setattr(self, attrname, scheme[key])
示例4: test_path
# 需要導入模塊: from distutils.command import install [as 別名]
# 或者: from distutils.command.install import SCHEME_KEYS [as 別名]
def test_path():
d = wheel.paths.get_install_paths('wheel')
assert len(d) == len(SCHEME_KEYS)
示例5: distutils_scheme
# 需要導入模塊: from distutils.command import install [as 別名]
# 或者: from distutils.command.install import SCHEME_KEYS [as 別名]
def distutils_scheme(dist_name, user=False, home=None, root=None):
"""
Return a distutils install scheme
"""
from distutils.dist import Distribution
scheme = {}
d = Distribution({'name': dist_name})
d.parse_config_files()
i = d.get_command_obj('install', create=True)
# NOTE: setting user or home has the side-effect of creating the home dir or
# user base for installations during finalize_options()
# ideally, we'd prefer a scheme class that has no side-effects.
i.user = user or i.user
i.home = home or i.home
i.root = root or i.root
i.finalize_options()
for key in SCHEME_KEYS:
scheme[key] = getattr(i, 'install_'+key)
if running_under_virtualenv():
scheme['headers'] = os.path.join(sys.prefix,
'include',
'site',
'python' + sys.version[:3],
dist_name)
if root is not None:
scheme["headers"] = os.path.join(
root,
os.path.abspath(scheme["headers"])[1:],
)
return scheme