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


Python setopt.edit_config函数代码示例

本文整理汇总了Python中setuptools.command.setopt.edit_config函数的典型用法代码示例。如果您正苦于以下问题:Python edit_config函数的具体用法?Python edit_config怎么用?Python edit_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: run

    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:52nlp,项目名称:Text-Summarization,代码行数:25,代码来源:alias.py

示例2: _set_fetcher_options

 def _set_fetcher_options(self, base):
     """
     When easy_install is about to run bdist_egg on a source dist,
     that source dist might have 'setup_requires' directives,
     requiring additional fetching. Ensure the fetcher options given
     to easy_install are available to that command as well.
     """
     from setuptools.command import setopt
     # find the fetch options from easy_install and write them out
     #  to the setup.cfg file.
     ei_opts = self.distribution.get_option_dict('easy_install'
                                                 ).copy()
     fetch_directives = (
         'find_links', 'site_dirs', 'index_url', 'optimize',
         'site_dirs', 'allow_hosts',
     )
     fetch_options = {}
     for key, val in ei_opts.items():
         if key not in fetch_directives:
             continue
         fetch_options[key.replace('_', '-')] = val[1]
     # create a settings dictionary suitable for `edit_config`
     settings = dict(easy_install=fetch_options)
     cfg_filename = os.path.join(base, 'setup.cfg')
     setopt.edit_config(cfg_filename, settings)
开发者ID:agiledata,项目名称:pkglib,代码行数:25,代码来源:dist.py

示例3: save_version_info

 def save_version_info(self, filename):
     from setuptools.command.setopt import edit_config
     edit_config(
         filename,
         {'egg_info':
             {'tag_svn_revision':0, 'tag_date': 0, 'tag_build': self.tags()}
         }
     )
开发者ID:31415us,项目名称:trajectory,代码行数:8,代码来源:egg_info.py

示例4: save_version_info

 def save_version_info(self, filename):
     values = dict(
         egg_info=dict(
             tag_svn_revision=0,
             tag_date=0,
             tag_build=self.tags(),
         )
     )
     edit_config(filename, values)
开发者ID:BamDastard,项目名称:my-first-blog,代码行数:9,代码来源:egg_info.py

示例5: save_version_info

 def save_version_info(self, filename):
     from setuptools.command.setopt import edit_config
     values = dict(
         egg_info=dict(
             tag_svn_revision=0,
             tag_date=0,
             tag_build=self.tags(),
         )
     )
     edit_config(filename, values)
开发者ID:Distrotech,项目名称:setuptools,代码行数:10,代码来源:egg_info.py

示例6: save_defaults

def save_defaults(**kw):
    """Save in ~/.pydistutils the author name and email.
    
    To be used as default value for the next use of this template."""
    options = {}
    for option in ("author", "author_email"):
        value = kw.get(option, "")
        if value:
            options["default.%s" % option] = value
    edit_config(config_file("user"), {"paver": options})
开发者ID:dinoboff,项目名称:paver-templates,代码行数:10,代码来源:__init__.py

示例7: test_utf8_encoding_retained

 def test_utf8_encoding_retained(self, tmpdir):
     """
     When editing a file, non-ASCII characters encoded in
     UTF-8 should be retained.
     """
     config = tmpdir.join('setup.cfg')
     self.write_text(str(config), '[names]\njaraco=джарако')
     setopt.edit_config(str(config), dict(names=dict(other='yes')))
     parser = self.parse_config(str(config))
     assert parser.get('names', 'jaraco') == 'джарако'
     assert parser.get('names', 'other') == 'yes'
开发者ID:pypa,项目名称:setuptools,代码行数:11,代码来源:test_setopt.py

示例8: save_version_info

 def save_version_info(self, filename):
     """
     Materialize the value of date into the
     build tag. Install build keys in a deterministic order
     to avoid arbitrary reordering on subsequent builds.
     """
     egg_info = collections.OrderedDict()
     # follow the order these keys would have been added
     # when PYTHONHASHSEED=0
     egg_info['tag_build'] = self.tags()
     egg_info['tag_date'] = 0
     edit_config(filename, dict(egg_info=egg_info))
开发者ID:jsirois,项目名称:pex,代码行数:12,代码来源:egg_info.py

示例9: run_example_settings

 def run_example_settings(self):
     from setuptools.command.setopt import edit_config
     dist = self.distribution
     packages = list(dist.packages)
     packages.sort(lambda a, b: cmp(len(a), len(b)))
     package_dir = os.path.join(dist.package_dir or '.', packages[0])
     settings = {
         'compress_resources':
         {'resource_dirs': os.path.join(package_dir, 'public'),
          'resource_files': 'file1.js\nfile2.js',
          'compress_js': 'True'}}
     edit_config('setup.cfg', settings, self.dry_run)
开发者ID:adrianpike,项目名称:wwscc,代码行数:12,代码来源:compress_resources.py

示例10: run

    def run(self):
        dist = self.distribution
        settings = {}

        for cmd in dist.command_options:

            if cmd == 'saveopts':
                continue  # don't save our own options!

            for opt, (src, val) in dist.get_option_dict(cmd).items():
                if src == "command line":
                    settings.setdefault(cmd, {})[opt] = val

        edit_config(self.filename, settings, self.dry_run)
开发者ID:ppyordanov,项目名称:HCI_4_Future_Cities,代码行数:14,代码来源:saveopts.py

示例11: save_version_info

 def save_version_info(self, filename):
     """
     Materialize the values of svn_revision and date into the
     build tag. Install these keys in a deterministic order
     to avoid arbitrary reordering on subsequent builds.
     """
     # python 2.6 compatibility
     odict = getattr(collections, 'OrderedDict', dict)
     egg_info = odict()
     # follow the order these keys would have been added
     # when PYTHONHASHSEED=0
     egg_info['tag_build'] = self.tags()
     egg_info['tag_date'] = 0
     egg_info['tag_svn_revision'] = 0
     edit_config(filename, dict(egg_info=egg_info))
开发者ID:lachand,项目名称:StageIndicateursMultiDispositifs,代码行数:15,代码来源:egg_info.py


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