本文整理汇总了Python中distutils.cmd方法的典型用法代码示例。如果您正苦于以下问题:Python distutils.cmd方法的具体用法?Python distutils.cmd怎么用?Python distutils.cmd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distutils
的用法示例。
在下文中一共展示了distutils.cmd方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_cmdline_options
# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import cmd [as 别名]
def get_cmdline_options(self):
"""Return a '{cmd: {opt:val}}' map of all command-line options
Option names are all long, but do not include the leading '--', and
contain dashes rather than underscores. If the option doesn't take
an argument (e.g. '--quiet'), the 'val' is 'None'.
Note that options provided by config files are intentionally excluded.
"""
d = {}
for cmd, opts in self.command_options.items():
for opt, (src, val) in opts.items():
if src != "command line":
continue
opt = opt.replace('_', '-')
if val == 0:
cmdobj = self.get_command_obj(cmd)
neg_opt = self.negative_opt.copy()
neg_opt.update(getattr(cmdobj, 'negative_opt', {}))
for neg, pos in neg_opt.items():
if pos == opt:
opt = neg
val = None
break
else:
raise AssertionError("Shouldn't be able to get here")
elif val == 1:
val = None
d.setdefault(cmd, {})[opt] = val
return d
示例2: create_command
# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import cmd [as 别名]
def create_command(text, commands):
"""Creates a custom setup.py command."""
class CustomCommand(BaseCommand):
description = text
def run(self):
for cmd in commands:
subprocess.check_call(cmd)
return CustomCommand
示例3: run
# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import cmd [as 别名]
def run(self):
pattern = "vies/locale/*/LC_MESSAGES/django.po"
for file in glob.glob(pattern):
cmd = ["msgfmt", "-c"]
name, ext = os.path.splitext(file)
cmd += ["-o", "%s.mo" % name]
cmd += ["%s.po" % name]
self.announce(
"running command: %s" % " ".join(cmd), level=distutils.log.INFO
)
subprocess.check_call(cmd, cwd=BASE_DIR) # nosec
示例4: run
# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import cmd [as 别名]
def run(self):
# shamelessly lifted from setuptools.command.test.test.run()
dist = self.distribution
if dist.install_requires:
dist.fetch_build_eggs(dist.install_requires)
if dist.tests_require:
dist.fetch_build_eggs(dist.tests_require)
cmd = self._test_cmd_string()
if self.dry_run:
self.announce("skipping '%s' (dry run)" % (cmd,))
else:
self.announce("running '%s'" % (cmd,))
self.with_project_on_sys_path(self.run_tests)
示例5: run
# 需要导入模块: import distutils [as 别名]
# 或者: from distutils import cmd [as 别名]
def run(self):
for cmd in pipenv_setup:
assert os.system(cmd) == 0
print(
"\npipenv run pytest runs the tests"
"\npipenv shell enters the virtualenv"
)