本文整理匯總了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 -------------------------------------