本文整理汇总了Python中distutils.command.sdist.sdist方法的典型用法代码示例。如果您正苦于以下问题:Python sdist.sdist方法的具体用法?Python sdist.sdist怎么用?Python sdist.sdist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distutils.command.sdist
的用法示例。
在下文中一共展示了sdist.sdist方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from distutils.command import sdist [as 别名]
# 或者: from distutils.command.sdist import sdist [as 别名]
def run(self):
if 'sdist' in sys.argv:
import warnings
import textwrap
msg = textwrap.dedent("""
`build_src` is being run, this may lead to missing
files in your sdist! You want to use distutils.sdist
instead of the setuptools version:
from distutils.command.sdist import sdist
cmdclass={'sdist': sdist}"
See numpy's setup.py or gh-7131 for details.""")
warnings.warn(msg, UserWarning, stacklevel=2)
# We need to ensure that build_src has been executed in order to give
# setuptools' egg_info command real filenames instead of functions which
# generate files.
self.run_command("build_src")
_egg_info.run(self)
示例2: run
# 需要导入模块: from distutils.command import sdist [as 别名]
# 或者: from distutils.command.sdist import sdist [as 别名]
def run(self):
self.run_command('egg_info')
ei_cmd = self.get_finalized_command('egg_info')
self.filelist = ei_cmd.filelist
self.filelist.append(os.path.join(ei_cmd.egg_info, 'SOURCES.txt'))
self.check_readme()
# Run sub commands
for cmd_name in self.get_sub_commands():
self.run_command(cmd_name)
# Call check_metadata only if no 'check' command
# (distutils <= 2.6)
import distutils.command
if 'check' not in distutils.command.__all__:
self.check_metadata()
self.make_distribution()
dist_files = getattr(self.distribution, 'dist_files', [])
for file in self.archive_files:
data = ('sdist', '', file)
if data not in dist_files:
dist_files.append(data)
示例3: run
# 需要导入模块: from distutils.command import sdist [as 别名]
# 或者: from distutils.command.sdist import sdist [as 别名]
def run(self):
self.run_command('egg_info')
ei_cmd = self.get_finalized_command('egg_info')
self.filelist = ei_cmd.filelist
self.filelist.append(os.path.join(ei_cmd.egg_info,'SOURCES.txt'))
self.check_readme()
# Run sub commands
for cmd_name in self.get_sub_commands():
self.run_command(cmd_name)
# Call check_metadata only if no 'check' command
# (distutils <= 2.6)
import distutils.command
if 'check' not in distutils.command.__all__:
self.check_metadata()
self.make_distribution()
dist_files = getattr(self.distribution,'dist_files',[])
for file in self.archive_files:
data = ('sdist', '', file)
if data not in dist_files:
dist_files.append(data)
示例4: run
# 需要导入模块: from distutils.command import sdist [as 别名]
# 或者: from distutils.command.sdist import sdist [as 别名]
def run(self):
self.run_command('egg_info')
ei_cmd = self.get_finalized_command('egg_info')
self.filelist = ei_cmd.filelist
self.filelist.append(os.path.join(ei_cmd.egg_info, 'SOURCES.txt'))
self.check_readme()
# Run sub commands
for cmd_name in self.get_sub_commands():
self.run_command(cmd_name)
self.make_distribution()
dist_files = getattr(self.distribution, 'dist_files', [])
for file in self.archive_files:
data = ('sdist', '', file)
if data not in dist_files:
dist_files.append(data)
示例5: test_unicode_metadata_tgz
# 需要导入模块: from distutils.command import sdist [as 别名]
# 或者: from distutils.command.sdist import sdist [as 别名]
def test_unicode_metadata_tgz(self):
"""
Unicode name or version should not break building to tar.gz format.
Reference issue #11638.
"""
# create the sdist command with unicode parameters
dist, cmd = self.get_cmd({'name': u'fake', 'version': u'1.0'})
# create the sdist as gztar and run the command
cmd.formats = ['gztar']
cmd.ensure_finalized()
cmd.run()
# The command should have created the .tar.gz file
dist_folder = join(self.tmp_dir, 'dist')
result = os.listdir(dist_folder)
self.assertEqual(result, ['fake-1.0.tar.gz'])
os.remove(join(dist_folder, 'fake-1.0.tar.gz'))
示例6: get_cmd
# 需要导入模块: from distutils.command import sdist [as 别名]
# 或者: from distutils.command.sdist import sdist [as 别名]
def get_cmd(self, metadata=None):
"""Returns a cmd"""
if metadata is None:
metadata = {'name': 'fake', 'version': '1.0',
'url': 'xxx', 'author': 'xxx',
'author_email': 'xxx'}
dist = Distribution(metadata)
dist.script_name = 'setup.py'
dist.packages = ['somecode']
dist.include_package_data = True
cmd = sdist(dist)
cmd.dist_dir = 'dist'
def _warn(*args):
pass
cmd.warn = _warn
return dist, cmd
示例7: __read_template_hack
# 需要导入模块: from distutils.command import sdist [as 别名]
# 或者: from distutils.command.sdist import sdist [as 别名]
def __read_template_hack(self):
# This grody hack closes the template file (MANIFEST.in) if an
# exception occurs during read_template.
# Doing so prevents an error when easy_install attempts to delete the
# file.
try:
orig.sdist.read_template(self)
except:
_, _, tb = sys.exc_info()
tb.tb_next.tb_frame.f_locals['template'].close()
raise
# Beginning with Python 2.7.2, 3.1.4, and 3.2.1, this leaky file handle
# has been fixed, so only override the method if we're using an earlier
# Python.
示例8: make_release_tree
# 需要导入模块: from distutils.command import sdist [as 别名]
# 或者: from distutils.command.sdist import sdist [as 别名]
def make_release_tree(self, base_dir, files):
orig.sdist.make_release_tree(self, base_dir, files)
# Save any egg_info command line options used to create this sdist
dest = os.path.join(base_dir, 'setup.cfg')
if hasattr(os, 'link') and os.path.exists(dest):
# unlink and re-copy, since it might be hard-linked, and
# we don't want to change the source version
os.unlink(dest)
self.copy_file('setup.cfg', dest)
self.get_finalized_command('egg_info').save_version_info(dest)
示例9: initialize_options
# 需要导入模块: from distutils.command import sdist [as 别名]
# 或者: from distutils.command.sdist import sdist [as 别名]
def initialize_options(self):
orig.sdist.initialize_options(self)
self._default_to_gztar()
示例10: make_distribution
# 需要导入模块: from distutils.command import sdist [as 别名]
# 或者: from distutils.command.sdist import sdist [as 别名]
def make_distribution(self):
"""
Workaround for #516
"""
with self._remove_os_link():
orig.sdist.make_distribution(self)
示例11: __read_template_hack
# 需要导入模块: from distutils.command import sdist [as 别名]
# 或者: from distutils.command.sdist import sdist [as 别名]
def __read_template_hack(self):
# This grody hack closes the template file (MANIFEST.in) if an
# exception occurs during read_template.
# Doing so prevents an error when easy_install attempts to delete the
# file.
try:
orig.sdist.read_template(self)
except Exception:
_, _, tb = sys.exc_info()
tb.tb_next.tb_frame.f_locals['template'].close()
raise
# Beginning with Python 2.7.2, 3.1.4, and 3.2.1, this leaky file handle
# has been fixed, so only override the method if we're using an earlier
# Python.
示例12: __read_template_hack
# 需要导入模块: from distutils.command import sdist [as 别名]
# 或者: from distutils.command.sdist import sdist [as 别名]
def __read_template_hack(self):
# This grody hack closes the template file (MANIFEST.in) if an
# exception occurs during read_template.
# Doing so prevents an error when easy_install attempts to delete the
# file.
try:
orig.sdist.read_template(self)
except:
sys.exc_info()[2].tb_next.tb_frame.f_locals['template'].close()
raise
# Beginning with Python 2.7.2, 3.1.4, and 3.2.1, this leaky file handle
# has been fixed, so only override the method if we're using an earlier
# Python.