本文整理汇总了Python中distutils.util.change_root方法的典型用法代码示例。如果您正苦于以下问题:Python util.change_root方法的具体用法?Python util.change_root怎么用?Python util.change_root使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distutils.util
的用法示例。
在下文中一共展示了util.change_root方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import change_root [as 别名]
def run(self):
self.mkpath(self.install_dir)
for f in self.data_files:
if isinstance(f, str):
# it's a simple file, so copy it
f = convert_path(f)
if self.warn_dir:
self.warn("setup script did not provide a directory for "
"'%s' -- installing right in '%s'" %
(f, self.install_dir))
(out, _) = self.copy_file(f, self.install_dir)
self.outfiles.append(out)
else:
# it's a tuple with path to install to and a list of files
dir = convert_path(f[0])
if not os.path.isabs(dir):
dir = os.path.join(self.install_dir, dir)
elif self.root:
dir = change_root(self.root, dir)
self.mkpath(dir)
if f[1] == []:
# If there are no files listed, the user must be
# trying to create an empty directory, so add the
# directory to the list of output files.
self.outfiles.append(dir)
else:
# Copy files, adding them to the list of output files.
for data in f[1]:
data = convert_path(data)
(out, _) = self.copy_file(data, dir)
self.outfiles.append(out)
示例2: change_roots
# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import change_root [as 别名]
def change_roots (self, *names):
for name in names:
attr = "install_" + name
setattr(self, attr, change_root(self.root, getattr(self, attr)))
示例3: change_roots
# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import change_root [as 别名]
def change_roots(self, *names):
"""Change the install directories pointed by name using root."""
for name in names:
attr = "install_" + name
setattr(self, attr, change_root(self.root, getattr(self, attr)))
示例4: finalize_options
# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import change_root [as 别名]
def finalize_options(self):
"""Finalize options"""
self.set_undefined_options('install',
('root', 'root'),
)
if not self.prefix:
self.prefix = '/usr/share/man'
if self.root:
self.prefix = change_root(self.root, self.prefix)
示例5: finalize_options
# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import change_root [as 别名]
def finalize_options(self):
"""Finalize options"""
self.set_undefined_options('install',
('root', 'root'),
('record', 'record'))
if not self.prefix:
self.prefix = '/usr/share/man'
if self.root:
self.prefix = change_root(self.root, self.prefix)
示例6: run
# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import change_root [as 别名]
def run (self):
self.mkpath(self.install_dir)
for f in self.data_files:
if type(f) is StringType:
# it's a simple file, so copy it
f = convert_path(f)
if self.warn_dir:
self.warn("setup script did not provide a directory for "
"'%s' -- installing right in '%s'" %
(f, self.install_dir))
(out, _) = self.copy_file(f, self.install_dir)
self.outfiles.append(out)
else:
# it's a tuple with path to install to and a list of files
dir = convert_path(f[0])
if not os.path.isabs(dir):
dir = os.path.join(self.install_dir, dir)
elif self.root:
dir = change_root(self.root, dir)
self.mkpath(dir)
if f[1] == []:
# If there are no files listed, the user must be
# trying to create an empty directory, so add the
# directory to the list of output files.
self.outfiles.append(dir)
else:
# Copy files, adding them to the list of output files.
for data in f[1]:
data = convert_path(data)
(out, _) = self.copy_file(data, dir)
self.outfiles.append(out)
示例7: change_roots
# 需要导入模块: from distutils import util [as 别名]
# 或者: from distutils.util import change_root [as 别名]
def change_roots (self, *names):
for name in names:
attr = "install_" + name
setattr(self, attr, change_root(self.root, getattr(self, attr)))
# -- Command execution methods -------------------------------------