當前位置: 首頁>>代碼示例>>Python>>正文


Python distutils.cmd方法代碼示例

本文整理匯總了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 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:41,代碼來源:dist.py

示例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 
開發者ID:SectorLabs,項目名稱:django-localized-fields,代碼行數:13,代碼來源:setup.py

示例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 
開發者ID:codingjoe,項目名稱:django-vies,代碼行數:14,代碼來源:setup.py

示例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) 
開發者ID:suds-community,項目名稱:suds,代碼行數:16,代碼來源:setup.py

示例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"
        ) 
開發者ID:projectcaluma,項目名稱:caluma,代碼行數:9,代碼來源:setup.py


注:本文中的distutils.cmd方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。