当前位置: 首页>>代码示例>>Python>>正文


Python setuptools.Command方法代码示例

本文整理汇总了Python中setuptools.Command方法的典型用法代码示例。如果您正苦于以下问题:Python setuptools.Command方法的具体用法?Python setuptools.Command怎么用?Python setuptools.Command使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在setuptools的用法示例。


在下文中一共展示了setuptools.Command方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: combine_commands

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def combine_commands(*commands):
    """Return a Command that combines several commands."""

    class CombinedCommand(Command):

        def initialize_options(self):
            self.commands = []
            for C in commands:
                self.commands.append(C(self.distribution))
            for c in self.commands:
                c.initialize_options()

        def finalize_options(self):
            for c in self.commands:
                c.finalize_options()

        def run(self):
            for c in self.commands:
                c.run()
    return CombinedCommand 
开发者ID:K3D-tools,项目名称:K3D-jupyter,代码行数:22,代码来源:setupbase.py

示例2: ensure_targets

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def ensure_targets(targets):
    """Return a Command that checks that certain files exist.

    Raises a ValueError if any of the files are missing.

    Note: The check is skipped if the `--skip-npm` flag is used.
    """

    class TargetsCheck(BaseCommand):
        def run(self):
            if skip_npm:
                log.info('Skipping target checks')
                return
            missing = [t for t in targets if not os.path.exists(t)]
            if missing:
                raise ValueError(('missing files: %s' % missing))

    return TargetsCheck


# `shutils.which` function copied verbatim from the Python-3.3 source. 
开发者ID:K3D-tools,项目名称:K3D-jupyter,代码行数:23,代码来源:setupbase.py

示例3: run

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def run(self):
        from grpc_tools import protoc
        include = pkg_resources.resource_filename('grpc_tools', '_proto')
        for src in glob(os.path.join(JAVA_PROTO_DIR, "*.proto")):
            command = ['grpc_tools.protoc',
                       '--proto_path=%s' % JAVA_PROTO_DIR,
                       '--proto_path=%s' % include,
                       '--python_out=%s' % SKEIN_PROTO_DIR,
                       '--grpc_python_out=%s' % SKEIN_PROTO_DIR,
                       src]
            if protoc.main(command) != 0:
                self.warn('Command: `%s` failed'.format(command))
                sys.exit(1)

        for path in _compiled_protos():
            self._fix_imports(path) 
开发者ID:jcrist,项目名称:skein,代码行数:18,代码来源:setup.py

示例4: RunCustomCommand

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def RunCustomCommand(self, command_list):
        print('Running command: %s' % command_list)
        p = subprocess.Popen(
            command_list,
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT,
        )
        # Can use communicate(input='y\n'.encode()) if the command run requires
        # some confirmation.
        stdout_data, _ = p.communicate()
        print('Command output: %s' % stdout_data)
        if p.returncode != 0:
            raise RuntimeError(
                'Command %s failed: exit code: %s' % (
                    command_list, p.returncode)
            ) 
开发者ID:leigh-johnson,项目名称:rpi-vision,代码行数:19,代码来源:setup.py

示例5: run

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def run(self):
        aliases = self.distribution.get_option_dict('aliases')

        if not self.args:
            print("Command Aliases")
            print("---------------")
            for alias in aliases:
                print("setup.py alias", format_alias(alias, aliases))
            return

        elif len(self.args)==1:
            alias, = self.args
            if self.remove:
                command = None
            elif alias in aliases:
                print("setup.py alias", format_alias(alias, aliases))
                return
            else:
                print("No alias definition found for %r" % alias)
                return
        else:
            alias = self.args[0]
            command = ' '.join(map(shquote,self.args[1:]))

        edit_config(self.filename, {'aliases': {alias:command}}, self.dry_run) 
开发者ID:GeekTrainer,项目名称:Flask,代码行数:27,代码来源:alias.py

示例6: combine_commands

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def combine_commands(*commands):
    """Return a Command that combines several commands."""

    class CombinedCommand(Command):
        user_options = []

        def initialize_options(self):
            self.commands = []
            for C in commands:
                self.commands.append(C(self.distribution))
            for c in self.commands:
                c.initialize_options()

        def finalize_options(self):
            for c in self.commands:
                c.finalize_options()

        def run(self):
            for c in self.commands:
                c.run()
    return CombinedCommand 
开发者ID:jupyter,项目名称:jupyter-packaging,代码行数:23,代码来源:setupbase.py

示例7: RunCustomCommand

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def RunCustomCommand(self, command_list):
    print 'Running command: %s' % command_list
    try:
      subprocess.call(command_list)
    except Exception as e:
      raise RuntimeError('Command %s failed with error: %s' % (command_list, e)) 
开发者ID:googlegenomics,项目名称:gcp-variant-transforms,代码行数:8,代码来源:setup.py

示例8: RunCustomCommand

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def RunCustomCommand(self, command_list):
        print 'Running command: %s' % command_list
        p = subprocess.Popen(
            command_list,
            stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
        # Can use communicate(input='y\n'.encode()) if the command run requires
        # some confirmation.
        stdout_data, _ = p.communicate()
        print 'Command output: %s' % stdout_data
        if p.returncode != 0:
            raise RuntimeError('Command %s failed: exit code: %s' % (command_list, p.returncode)) 
开发者ID:GoogleCloudPlatform,项目名称:cloudml-samples,代码行数:13,代码来源:setup.py

示例9: patch_all

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def patch_all():
    # we can't patch distutils.cmd, alas
    distutils.core.Command = setuptools.Command

    has_issue_12885 = sys.version_info <= (3, 5, 3)

    if has_issue_12885:
        # fix findall bug in distutils (http://bugs.python.org/issue12885)
        distutils.filelist.findall = setuptools.findall

    needs_warehouse = (
        sys.version_info < (2, 7, 13)
        or
        (3, 4) < sys.version_info < (3, 4, 6)
        or
        (3, 5) < sys.version_info <= (3, 5, 3)
    )

    if needs_warehouse:
        warehouse = 'https://upload.pypi.org/legacy/'
        distutils.config.PyPIRCCommand.DEFAULT_REPOSITORY = warehouse

    _patch_distribution_metadata()

    # Install Distribution throughout the distutils
    for module in distutils.dist, distutils.core, distutils.cmd:
        module.Distribution = setuptools.dist.Distribution

    # Install the patched Extension
    distutils.core.Extension = setuptools.extension.Extension
    distutils.extension.Extension = setuptools.extension.Extension
    if 'distutils.command.build_ext' in sys.modules:
        sys.modules['distutils.command.build_ext'].Extension = (
            setuptools.extension.Extension
        )

    patch_for_msvc_specialized_compiler() 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:39,代码来源:monkey.py

示例10: patch_all

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def patch_all():
    # we can't patch distutils.cmd, alas
    distutils.core.Command = setuptools.Command

    has_issue_12885 = sys.version_info <= (3, 5, 3)

    if has_issue_12885:
        # fix findall bug in distutils (http://bugs.python.org/issue12885)
        distutils.filelist.findall = setuptools.findall

    needs_warehouse = (
        sys.version_info < (2, 7, 13)
        or
        (3, 4) < sys.version_info < (3, 4, 6)
        or
        (3, 5) < sys.version_info <= (3, 5, 3)
    )

    if needs_warehouse:
        warehouse = 'https://upload.pypi.org/legacy/'
        distutils.config.PyPIRCCommand.DEFAULT_REPOSITORY = warehouse

    _patch_distribution_metadata()

    # Install Distribution throughout the distutils
    for module in distutils.dist, distutils.core, distutils.cmd:
        module.Distribution = setuptools.dist.Distribution

    # Install the patched Extension
    distutils.core.Extension = setuptools.extension.Extension
    distutils.extension.Extension = setuptools.extension.Extension
    if 'distutils.command.build_ext' in sys.modules:
        sys.modules['distutils.command.build_ext'].Extension = (
            setuptools.extension.Extension
        )

    #patch_for_msvc_specialized_compiler() 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:39,代码来源:monkey.py

示例11: RunCustomCommand

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def RunCustomCommand(self, command_list):
    print 'Running command: %s' % command_list
    p = subprocess.Popen(
        command_list,
        stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    # Can use communicate(input='y\n'.encode()) if the command run requires
    # some confirmation.
    stdout_data, _ = p.communicate()
    print 'Command output: %s' % stdout_data
    if p.returncode != 0:
      raise RuntimeError(
          'Command %s failed: exit code: %s' % (command_list, p.returncode)) 
开发者ID:amygdala,项目名称:gae-dataflow,代码行数:14,代码来源:setup.py

示例12: get_release_command_class

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def get_release_command_class() -> Dict[str, setuptools.Command]:
    try:
        from releasecmd import ReleaseCommand
    except ImportError:
        return {}

    return {"release": ReleaseCommand} 
开发者ID:thombashi,项目名称:SimpleSQLite,代码行数:9,代码来源:setup.py

示例13: patch_all

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def patch_all():
    # we can't patch distutils.cmd, alas
    distutils.core.Command = setuptools.Command

    has_issue_12885 = sys.version_info <= (3, 5, 3)

    if has_issue_12885:
        # fix findall bug in distutils (http://bugs.python.org/issue12885)
        distutils.filelist.findall = setuptools.findall

    needs_warehouse = (
        sys.version_info < (2, 7, 13)
        or
        (3, 0) < sys.version_info < (3, 3, 7)
        or
        (3, 4) < sys.version_info < (3, 4, 6)
        or
        (3, 5) < sys.version_info <= (3, 5, 3)
    )

    if needs_warehouse:
        warehouse = 'https://upload.pypi.org/legacy/'
        distutils.config.PyPIRCCommand.DEFAULT_REPOSITORY = warehouse

    _patch_distribution_metadata_write_pkg_file()
    _patch_distribution_metadata_write_pkg_info()

    # Install Distribution throughout the distutils
    for module in distutils.dist, distutils.core, distutils.cmd:
        module.Distribution = setuptools.dist.Distribution

    # Install the patched Extension
    distutils.core.Extension = setuptools.extension.Extension
    distutils.extension.Extension = setuptools.extension.Extension
    if 'distutils.command.build_ext' in sys.modules:
        sys.modules['distutils.command.build_ext'].Extension = (
            setuptools.extension.Extension
        )

    patch_for_msvc_specialized_compiler() 
开发者ID:italia,项目名称:anpr,代码行数:42,代码来源:monkey.py

示例14: patch_all

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def patch_all():
    # we can't patch distutils.cmd, alas
    distutils.core.Command = setuptools.Command

    has_issue_12885 = sys.version_info <= (3, 5, 3)

    if has_issue_12885:
        # fix findall bug in distutils (http://bugs.python.org/issue12885)
        distutils.filelist.findall = setuptools.findall

    needs_warehouse = (
        sys.version_info < (2, 7, 13)
        or
        (3, 4) < sys.version_info < (3, 4, 6)
        or
        (3, 5) < sys.version_info <= (3, 5, 3)
    )

    if needs_warehouse:
        warehouse = 'https://upload.pypi.org/legacy/'
        distutils.config.PyPIRCCommand.DEFAULT_REPOSITORY = warehouse

    _patch_distribution_metadata_write_pkg_file()

    # Install Distribution throughout the distutils
    for module in distutils.dist, distutils.core, distutils.cmd:
        module.Distribution = setuptools.dist.Distribution

    # Install the patched Extension
    distutils.core.Extension = setuptools.extension.Extension
    distutils.extension.Extension = setuptools.extension.Extension
    if 'distutils.command.build_ext' in sys.modules:
        sys.modules['distutils.command.build_ext'].Extension = (
            setuptools.extension.Extension
        )

    patch_for_msvc_specialized_compiler() 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:39,代码来源:monkey.py

示例15: call

# 需要导入模块: import setuptools [as 别名]
# 或者: from setuptools import Command [as 别名]
def call(self, command):
        env = os.environ.copy()
        env['PYTHONPATH'] = ''.join(':' + x for x in sys.path)
        self.announce('Run command: {}'.format(command), level=2)
        try:
            subprocess.check_call(command.split(), env=env)
        except subprocess.CalledProcessError as error:
            self._returncode = 1
            message = 'Command failed with exit code {}'
            message = message.format(error.returncode)
            self.announce(message, level=2) 
开发者ID:danijar,项目名称:mindpark,代码行数:13,代码来源:setup.py


注:本文中的setuptools.Command方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。