本文整理匯總了Python中setuptools.command.sdist.sdist方法的典型用法代碼示例。如果您正苦於以下問題:Python sdist.sdist方法的具體用法?Python sdist.sdist怎麽用?Python sdist.sdist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類setuptools.command.sdist
的用法示例。
在下文中一共展示了sdist.sdist方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: js_prerelease
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def js_prerelease(command, strict=False):
"""decorator for building minified js/css prior to another command"""
class DecoratedCommand(command):
def run(self):
jsdeps = self.distribution.get_command_obj('jsdeps')
if not is_repo and all(exists(t) for t in jsdeps.targets):
# sdist, nothing to do
command.run(self)
return
try:
self.distribution.run_command('jsdeps')
except Exception as e:
missing = [t for t in jsdeps.targets if not exists(t)]
if strict or missing:
log.warn('rebuilding js and css failed')
if missing:
log.error('missing files: %s' % missing)
raise e
else:
log.warn('rebuilding js and css failed (not a problem)')
log.warn(str(e))
command.run(self)
update_package_data(self.distribution)
return DecoratedCommand
示例2: test_package_data_in_sdist
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def test_package_data_in_sdist(self):
"""Regression test for pull request #4: ensures that files listed in
package_data are included in the manifest even if they're not added to
version control.
"""
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
# squelch output
quiet()
try:
cmd.run()
finally:
unquiet()
manifest = cmd.filelist.files
self.assertTrue(os.path.join('sdist_test', 'a.txt') in manifest)
self.assertTrue(os.path.join('sdist_test', 'b.txt') in manifest)
self.assertTrue(os.path.join('sdist_test', 'c.rst') not in manifest)
示例3: add_defaults
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def add_defaults(self):
option_dict = self.distribution.get_option_dict('pbr')
sdist.sdist.add_defaults(self)
self.filelist.append(self.template)
self.filelist.append(self.manifest)
self.filelist.extend(extra_files.get_extra_files())
should_skip = options.get_boolean_option(option_dict, 'skip_git_sdist',
'SKIP_GIT_SDIST')
if not should_skip:
rcfiles = git._find_git_files()
if rcfiles:
self.filelist.extend(rcfiles)
elif os.path.exists(self.manifest):
self.read_manifest()
ei_cmd = self.get_finalized_command('egg_info')
self._add_pbr_defaults()
self.filelist.include_pattern("*", prefix=ei_cmd.egg_info)
示例4: find_sources
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def find_sources(self):
"""Generate SOURCES.txt only if there isn't one already.
If we are in an sdist command, then we always want to update
SOURCES.txt. If we are not in an sdist command, then it doesn't
matter one flip, and is actually destructive.
However, if we're in a git context, it's always the right thing to do
to recreate SOURCES.txt
"""
manifest_filename = os.path.join(self.egg_info, "SOURCES.txt")
if (not os.path.exists(manifest_filename) or
os.path.exists('.git') or
'sdist' in sys.argv):
log.info("[pbr] Processing SOURCES.txt")
mm = LocalManifestMaker(self.distribution)
mm.manifest = manifest_filename
mm.run()
self.filelist = mm.filelist
else:
log.info("[pbr] Reusing existing SOURCES.txt")
self.filelist = egg_info.FileList()
for entry in open(manifest_filename, 'r').read().split('\n'):
self.filelist.append(entry)
示例5: create_cmdclass
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def create_cmdclass(wrappers=None, data_dirs=None):
"""Create a command class with the given optional wrappers.
Parameters
----------
wrappers: list(str), optional
The cmdclass names to run before running other commands
data_dirs: list(str), optional.
The directories containing static data.
"""
egg = bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled
wrappers = wrappers or []
data_dirs = data_dirs or []
wrapper = functools.partial(wrap_command, wrappers, data_dirs)
cmdclass = dict(
build_py=wrapper(build_py, strict=is_repo),
sdist=wrapper(sdist, strict=True),
bdist_egg=egg,
develop=wrapper(develop, strict=True)
)
if bdist_wheel:
cmdclass['bdist_wheel'] = wrapper(bdist_wheel, strict=True)
return cmdclass
示例6: test_package_data_in_sdist
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def test_package_data_in_sdist(self):
"""Regression test for pull request #4: ensures that files listed in
package_data are included in the manifest even if they're not added to
version control.
"""
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
with quiet():
cmd.run()
manifest = cmd.filelist.files
self.assertTrue(os.path.join('sdist_test', 'a.txt') in manifest)
self.assertTrue(os.path.join('sdist_test', 'b.txt') in manifest)
self.assertTrue(os.path.join('sdist_test', 'c.rst') not in manifest)
示例7: test_defaults_case_sensitivity
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def test_defaults_case_sensitivity(self):
"""
Make sure default files (README.*, etc.) are added in a case-sensitive
way to avoid problems with packages built on Windows.
"""
open(os.path.join(self.temp_dir, 'readme.rst'), 'w').close()
open(os.path.join(self.temp_dir, 'SETUP.cfg'), 'w').close()
dist = Distribution(SETUP_ATTRS)
# the extension deliberately capitalized for this test
# to make sure the actual filename (not capitalized) gets added
# to the manifest
dist.script_name = 'setup.PY'
cmd = sdist(dist)
cmd.ensure_finalized()
with quiet():
cmd.run()
# lowercase all names so we can test in a case-insensitive way to make sure the files are not included
manifest = map(lambda x: x.lower(), cmd.filelist.files)
self.assertFalse('readme.rst' in manifest, manifest)
self.assertFalse('setup.py' in manifest, manifest)
self.assertFalse('setup.cfg' in manifest, manifest)
示例8: js_prerelease
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def js_prerelease(command, strict=False):
"""decorator for building minified js/css prior to another command"""
class DecoratedCommand(command):
def run(self):
jsdeps = self.distribution.get_command_obj('jsdeps')
if not is_repo and all(os.path.exists(t) for t in jsdeps.targets):
# sdist, nothing to do
command.run(self)
return
try:
self.distribution.run_command('jsdeps')
except Exception as e:
missing = [t for t in jsdeps.targets if not os.path.exists(t)]
if strict or missing:
log.warn('rebuilding js and css failed')
if missing:
log.error('missing files: %s' % missing)
raise e
else:
log.warn('rebuilding js and css failed (not a problem)')
log.warn(str(e))
command.run(self)
update_package_data(self.distribution)
return DecoratedCommand
示例9: test_package_data_in_sdist
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def test_package_data_in_sdist(self):
"""Regression test for pull request #4: ensures that files listed in
package_data are included in the manifest even if they're not added to
version control.
"""
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
with quiet():
cmd.run()
manifest = cmd.filelist.files
assert os.path.join('sdist_test', 'a.txt') in manifest
assert os.path.join('sdist_test', 'b.txt') in manifest
assert os.path.join('sdist_test', 'c.rst') not in manifest
assert os.path.join('d', 'e.dat') in manifest
示例10: run
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def run(self):
"""
Run first the git commit format update $Format:%H$
and after that the usual Python sdist
"""
# git attributes
command = ['make', 'git_attributes']
self.announce(
'Running make git_attributes target: %s' % str(command),
level=distutils.log.INFO
)
self.announce(
subprocess.check_output(command).decode(),
level=distutils.log.INFO
)
# standard sdist process
setuptools_sdist.sdist.run(self)
# cleanup attributes
command = ['make', 'clean_git_attributes']
self.announce(
subprocess.check_output(command).decode(),
level=distutils.log.INFO
)
示例11: js_prerelease
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def js_prerelease(command, strict=False):
"""Decorator for building minified js/css prior to another command."""
class DecoratedCommand(command):
def run(self):
jsdeps = self.distribution.get_command_obj('jsdeps')
if not is_repo and all(os.path.exists(t) for t in jsdeps.targets):
# sdist, nothing to do
command.run(self)
return
try:
self.distribution.run_command('jsdeps')
except Exception as e:
missing = [t for t in jsdeps.targets if not os.path.exists(t)]
if strict or missing:
log.warn('rebuilding js and css failed')
if missing:
log.error('missing files: %s' % missing)
raise e
else:
log.warn('rebuilding js and css failed (not a problem)')
log.warn(str(e))
command.run(self)
update_package_data(self.distribution)
return DecoratedCommand
示例12: initialize_options
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def initialize_options(self):
self.sdist = sdist(self.distribution)
self.bdist_wheel = bdist_wheel(self.distribution)
self.sdist.initialize_options()
self.bdist_wheel.initialize_options()
示例13: finalize_options
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def finalize_options(self):
self.sdist.finalize_options()
self.bdist_wheel.finalize_options()
self.finalized = 1
示例14: run
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def run(self):
self.sdist.run()
self.bdist_wheel.run()
示例15: test_manifest_is_read_with_utf8_encoding
# 需要導入模塊: from setuptools.command import sdist [as 別名]
# 或者: from setuptools.command.sdist import sdist [as 別名]
def test_manifest_is_read_with_utf8_encoding(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
# Create manifest
quiet()
try:
cmd.run()
finally:
unquiet()
# Add UTF-8 filename to manifest
filename = os.path.join(b('sdist_test'), b('smörbröd.py'))
cmd.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
manifest = open(cmd.manifest, 'ab')
manifest.write(b('\n')+filename)
manifest.close()
# The file must exist to be included in the filelist
open(filename, 'w').close()
# Re-read manifest
cmd.filelist.files = []
quiet()
try:
cmd.read_manifest()
finally:
unquiet()
# The filelist should contain the UTF-8 filename
if sys.version_info >= (3,):
filename = filename.decode('utf-8')
self.assertTrue(filename in cmd.filelist.files)
# Python 3 only