我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用setuptools.setup.cfg()。
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. """ # 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)
def _opt_value(cfg, into, section, key, transform = None): try: v = cfg.get(section, key) if transform != _as_lines and ';' in v: v, marker = v.rsplit(';', 1) if not eval_marker(marker): return v = v.strip() if v: if transform: into[key] = transform(v.strip()) else: into[key] = v.strip() except (NoOptionError, NoSectionError): pass
def setup_package(): src_path = os.path.dirname(os.path.abspath(sys.argv[0])) old_path = os.getcwd() os.chdir(src_path) sys.path.insert(0, src_path) try: # See setup.cfg setup(name='searchgrid', version='0.2-dev', py_modules=['searchgrid'], setup_requires=['pytest-runner'], tests_require=['pytest>=2.7', 'pytest-cov~=2.4'], install_requires=['numpy', 'scipy', 'scikit-learn~=0.18']) finally: del sys.path[0] os.chdir(old_path) return