本文整理汇总了Python中distutils.command.install.install.run方法的典型用法代码示例。如果您正苦于以下问题:Python install.run方法的具体用法?Python install.run怎么用?Python install.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distutils.command.install.install
的用法示例。
在下文中一共展示了install.run方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from distutils.command.install import install [as 别名]
# 或者: from distutils.command.install.install import run [as 别名]
def run(self):
if not have_setuptools:
r = old_install.run(self)
else:
r = self.setuptools_run()
if self.record:
# bdist_rpm fails when INSTALLED_FILES contains
# paths with spaces. Such paths must be enclosed
# with double-quotes.
f = open(self.record, 'r')
lines = []
need_rewrite = False
for l in f:
l = l.rstrip()
if ' ' in l:
need_rewrite = True
l = '"%s"' % (l)
lines.append(l)
f.close()
if need_rewrite:
self.execute(write_file,
(self.record, lines),
"re-writing list of installed files to '%s'" %
self.record)
return r
示例2: run
# 需要导入模块: from distutils.command.install import install [as 别名]
# 或者: from distutils.command.install.install import run [as 别名]
def run(self):
if self.corpora_zip_url is None:
self.corpora_zip_url = os.environ.get(
"CORPORA_ZIP_URL",
"https://github.com/dariusk/corpora/archive/master.zip",
)
print("Installing corpora data from " + self.corpora_zip_url)
mkpath("./corpora-download")
resp = urlopen(self.corpora_zip_url).read()
remote = io.BytesIO(resp)
zf = zipfile.ZipFile(remote, "r")
zf.extractall("corpora-download")
try:
data_dir = glob.glob("./corpora-download/*/data")[0]
except IndexError:
raise IndexError(
"malformed corpora archive: expecting a subdirectory '*/data'")
copy_tree(data_dir, "pycorpora/data")
install.run(self)
示例3: run
# 需要导入模块: from distutils.command.install import install [as 别名]
# 或者: from distutils.command.install.install import run [as 别名]
def run(self):
"""Run the command"""
srcdir = os.path.join('docs', 'man')
manpages = os.listdir(srcdir)
self._outfiles = []
for man in manpages:
src_man = os.path.join(srcdir, man)
section = os.path.splitext(man)[1][1:]
dest_dir = os.path.join(self.prefix, 'man' + section)
self.mkpath(dest_dir) # Could be different section
dest_man = os.path.join(dest_dir, man)
self.copy_file(src_man, dest_man)
self._outfiles.append(dest_man)
# Disabled, done in the RPM spec
# self._write_record()
示例4: run
# 需要导入模块: from distutils.command.install import install [as 别名]
# 或者: from distutils.command.install.install import run [as 别名]
def run(self):
install.run(self)
user = '--user' in sys.argv
try:
from jupyter_client.kernelspec import install_kernel_spec
except ImportError:
from IPython.kernel.kernelspec import install_kernel_spec
from IPython.utils.tempdir import TemporaryDirectory
with TemporaryDirectory() as td:
os.chmod(td, 0o755) # Starts off as 700, not user readable
with open(os.path.join(td, 'kernel.json'), 'w') as f:
json.dump(kernel_json, f, sort_keys=True)
log.info('Installing kernel spec')
kernel_name = kernel_json['name']
try:
install_kernel_spec(td, kernel_name, user=user,
replace=True)
except:
install_kernel_spec(td, kernel_name, user=not user,
replace=True)
示例5: run
# 需要导入模块: from distutils.command.install import install [as 别名]
# 或者: from distutils.command.install.install import run [as 别名]
def run(self):
# Explicit request for old-style install? Just do it
if self.old_and_unmanageable or self.single_version_externally_managed:
return _install.run(self)
# Attempt to detect whether we were called from setup() or by another
# command. If we were called by setup(), our caller will be the
# 'run_command' method in 'distutils.dist', and *its* caller will be
# the 'run_commands' method. If we were called any other way, our
# immediate caller *might* be 'run_command', but it won't have been
# called by 'run_commands'. This is slightly kludgy, but seems to
# work.
#
caller = sys._getframe(2)
caller_module = caller.f_globals.get('__name__','')
caller_name = caller.f_code.co_name
if caller_module != 'distutils.dist' or caller_name!='run_commands':
# We weren't called from the command line or setup(), so we
# should run in backward-compatibility mode to support bdist_*
# commands.
_install.run(self)
else:
self.do_egg_install()
示例6: do_egg_install
# 需要导入模块: from distutils.command.install import install [as 别名]
# 或者: from distutils.command.install.install import run [as 别名]
def do_egg_install(self):
easy_install = self.distribution.get_command_class('easy_install')
cmd = easy_install(
self.distribution, args="x", root=self.root, record=self.record,
)
cmd.ensure_finalized() # finalize before bdist_egg munges install cmd
cmd.always_copy_from = '.' # make sure local-dir eggs get installed
# pick up setup-dir .egg files only: no .egg-info
cmd.package_index.scan(glob.glob('*.egg'))
self.run_command('bdist_egg')
args = [self.distribution.get_command_obj('bdist_egg').egg_output]
if setuptools.bootstrap_install_from:
# Bootstrap self-installation of setuptools
args.insert(0, setuptools.bootstrap_install_from)
cmd.args = args
cmd.run()
setuptools.bootstrap_install_from = None
# XXX Python 3.1 doesn't see _nc if this is inside the class
示例7: setuptools_run
# 需要导入模块: from distutils.command.install import install [as 别名]
# 或者: from distutils.command.install.install import run [as 别名]
def setuptools_run(self):
""" The setuptools version of the .run() method.
We must pull in the entire code so we can override the level used in the
_getframe() call since we wrap this call by one more level.
"""
from distutils.command.install import install as distutils_install
# Explicit request for old-style install? Just do it
if self.old_and_unmanageable or self.single_version_externally_managed:
return distutils_install.run(self)
# Attempt to detect whether we were called from setup() or by another
# command. If we were called by setup(), our caller will be the
# 'run_command' method in 'distutils.dist', and *its* caller will be
# the 'run_commands' method. If we were called any other way, our
# immediate caller *might* be 'run_command', but it won't have been
# called by 'run_commands'. This is slightly kludgy, but seems to
# work.
#
caller = sys._getframe(3)
caller_module = caller.f_globals.get('__name__', '')
caller_name = caller.f_code.co_name
if caller_module != 'distutils.dist' or caller_name!='run_commands':
# We weren't called from the command line or setup(), so we
# should run in backward-compatibility mode to support bdist_*
# commands.
distutils_install.run(self)
else:
self.do_egg_install()