本文整理汇总了Python中pythonbrew.util.Subprocess.call方法的典型用法代码示例。如果您正苦于以下问题:Python Subprocess.call方法的具体用法?Python Subprocess.call怎么用?Python Subprocess.call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pythonbrew.util.Subprocess
的用法示例。
在下文中一共展示了Subprocess.call方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_command_clone
# 需要导入模块: from pythonbrew.util import Subprocess [as 别名]
# 或者: from pythonbrew.util.Subprocess import call [as 别名]
def run_command_clone(self, options, args):
if len(args) < 3:
logger.error("Unrecognized command line argument: ( 'pythonbrew venv clone <source> <target>' )")
sys.exit(1)
if not os.access(PATH_VENVS, os.W_OK):
logger.error("Can not clone a virtual environment in %s.\nPermission denied." % PATH_VENVS)
sys.exit(1)
if not self._pkgname:
logger.error("Unknown python version: ( 'pythonbrew venv clone <source> <target> -p VERSION' )")
sys.exit(1)
source, target = args[1], args[2]
source_dir = os.path.join(self._workon_home, source)
target_dir = os.path.join(self._workon_home, target)
if not os.path.isdir(source_dir):
logger.error('%s does not exist.' % source_dir)
sys.exit(1)
if os.path.isdir(target_dir):
logger.error('Can not overwrite %s.' % target_dir)
sys.exit(1)
logger.info("Cloning `%s` environment into `%s` on %s" % (source, target, self._workon_home))
# Copies source to target
cmd = [self._py, self._venv_clone, source_dir, target_dir]
s = Subprocess()
s.call(cmd)
示例2: make
# 需要导入模块: from pythonbrew.util import Subprocess [as 别名]
# 或者: from pythonbrew.util.Subprocess import call [as 别名]
def make(self):
jobs = self.options.jobs
make = ((jobs > 0 and 'make -j%s' % jobs) or 'make')
s = Subprocess(log=self.logfile, cwd=self.build_dir, verbose=self.options.verbose)
s.check_call(make)
if not self.options.no_test:
if self.options.force:
# note: ignore tests failure error.
s.call("make test")
else:
s.check_call("make test")
示例3: run_command_create
# 需要导入模块: from pythonbrew.util import Subprocess [as 别名]
# 或者: from pythonbrew.util.Subprocess import call [as 别名]
def run_command_create(self, options, args):
if not os.access(PATH_VENVS, os.W_OK):
logger.error("Can not create a virtual environment in %s.\nPermission denied." % PATH_VENVS)
sys.exit(1)
virtualenv_options = []
if options.no_site_packages:
virtualenv_options.append('--no-site-packages')
for arg in args[1:]:
target_dir = os.path.join(self._workon_home, arg)
logger.info("Creating `%s` environment into %s" % (arg, self._workon_home))
# make command
cmd = [self._py, self._venv, '-p', self._target_py]
cmd.extend(virtualenv_options)
cmd.append(target_dir)
# create environment
s = Subprocess(verbose=True)
s.call(cmd)