本文整理汇总了Python中setuptools.command.sdist.sdist函数的典型用法代码示例。如果您正苦于以下问题:Python sdist函数的具体用法?Python sdist怎么用?Python sdist使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sdist函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_sdist_with_utf8_encoded_filename
def test_sdist_with_utf8_encoded_filename(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
# UTF-8 filename
filename = os.path.join(b('sdist_test'), b('smörbröd.py'))
open(filename, 'w').close()
quiet()
try:
cmd.run()
finally:
unquiet()
if sys.platform == 'darwin':
filename = decompose(filename)
if sys.version_info >= (3,):
if sys.platform == 'win32':
# Python 3 mangles the UTF-8 filename
filename = filename.decode('cp1252')
self.assertTrue(filename in cmd.filelist.files)
else:
filename = filename.decode('utf-8')
self.assertTrue(filename in cmd.filelist.files)
else:
self.assertTrue(filename in cmd.filelist.files)
开发者ID:670information,项目名称:SmartCalendar,代码行数:30,代码来源:test_sdist.py
示例2: test_sdist_with_utf8_encoded_filename
def test_sdist_with_utf8_encoded_filename(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
filename = os.path.join(b'sdist_test', Filenames.utf_8)
open(filename, 'w').close()
with quiet():
cmd.run()
if sys.platform == 'darwin':
filename = decompose(filename)
if six.PY3:
fs_enc = sys.getfilesystemencoding()
if sys.platform == 'win32':
if fs_enc == 'cp1252':
# Python 3 mangles the UTF-8 filename
filename = filename.decode('cp1252')
assert filename in cmd.filelist.files
else:
filename = filename.decode('mbcs')
assert filename in cmd.filelist.files
else:
filename = filename.decode('utf-8')
assert filename in cmd.filelist.files
else:
assert filename in cmd.filelist.files
开发者ID:Slicer,项目名称:setuptools,代码行数:32,代码来源:test_sdist.py
示例3: test_manifest_is_read_with_surrogateescape_error_handler
def test_manifest_is_read_with_surrogateescape_error_handler(self):
# Test for #303.
# This is hard to test on HFS Plus because it quotes unknown
# bytes (see previous test). Furthermore, egg_info.FileList
# only appends filenames that os.path.exist.
# We therefore write the manifest file by hand and check whether
# read_manifest produces a UnicodeDecodeError.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
filename = os.path.join(b('sdist_test'), LATIN1_FILENAME)
quiet()
try:
cmd.run()
# Add Latin-1 filename to manifest
cmd.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
manifest = open(cmd.manifest, 'ab')
manifest.write(filename+b('\n'))
manifest.close()
# Re-read manifest
try:
cmd.read_manifest()
except UnicodeDecodeError, e:
self.fail(e)
finally:
unquiet()
开发者ID:CfABrigadePhiladelphia,项目名称:Wikidelphia,代码行数:31,代码来源:test_sdist.py
示例4: test_manifest_is_read_with_utf8_encoding
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
with quiet():
cmd.run()
# Add UTF-8 filename to manifest
filename = os.path.join(b'sdist_test', Filenames.utf_8)
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 = []
with quiet():
cmd.read_manifest()
# The filelist should contain the UTF-8 filename
if six.PY3:
filename = filename.decode('utf-8')
assert filename in cmd.filelist.files
开发者ID:Slicer,项目名称:setuptools,代码行数:30,代码来源:test_sdist.py
示例5: test_read_manifest_skips_non_utf8_filenames
def test_read_manifest_skips_non_utf8_filenames(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
# Create manifest
with quiet():
cmd.run()
# Add Latin-1 filename to manifest
filename = os.path.join(b('sdist_test'), LATIN1_FILENAME)
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 = []
with quiet():
try:
cmd.read_manifest()
except UnicodeDecodeError:
e = sys.exc_info()[1]
self.fail(e)
# The Latin-1 filename should have been skipped
filename = filename.decode('latin-1')
self.assertFalse(filename in cmd.filelist.files)
开发者ID:ArchAiA,项目名称:skillshare,代码行数:33,代码来源:test_sdist.py
示例6: test_manifest_is_read_with_utf8_encoding
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
with quiet():
cmd.run()
# 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 = []
with quiet():
cmd.read_manifest()
# The filelist should contain the UTF-8 filename
if six.PY3:
filename = filename.decode("utf-8")
assert filename in cmd.filelist.files
开发者ID:haloteam,项目名称:halo,代码行数:30,代码来源:test_sdist.py
示例7: test_read_manifest_skips_non_utf8_filenames
def test_read_manifest_skips_non_utf8_filenames(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
# Create manifest
with quiet():
cmd.run()
# Add Latin-1 filename to manifest
filename = os.path.join(b'sdist_test', Filenames.latin_1)
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 = []
with quiet():
cmd.read_manifest()
# The Latin-1 filename should have been skipped
filename = filename.decode('latin-1')
assert filename not in cmd.filelist.files
开发者ID:Slicer,项目名称:setuptools,代码行数:29,代码来源:test_sdist.py
示例8: test_sdist_with_utf8_encoded_filename
def test_sdist_with_utf8_encoded_filename(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = "setup.py"
cmd = sdist(dist)
cmd.ensure_finalized()
# UTF-8 filename
filename = os.path.join(b("sdist_test"), b("smörbröd.py"))
open(filename, "w").close()
with quiet():
cmd.run()
if sys.platform == "darwin":
filename = decompose(filename)
if six.PY3:
fs_enc = sys.getfilesystemencoding()
if sys.platform == "win32":
if fs_enc == "cp1252":
# Python 3 mangles the UTF-8 filename
filename = filename.decode("cp1252")
assert filename in cmd.filelist.files
else:
filename = filename.decode("mbcs")
assert filename in cmd.filelist.files
else:
filename = filename.decode("utf-8")
assert filename in cmd.filelist.files
else:
assert filename in cmd.filelist.files
开发者ID:haloteam,项目名称:halo,代码行数:33,代码来源:test_sdist.py
示例9: test_read_manifest_skips_non_utf8_filenames
def test_read_manifest_skips_non_utf8_filenames(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = "setup.py"
cmd = sdist(dist)
cmd.ensure_finalized()
# Create manifest
with quiet():
cmd.run()
# Add Latin-1 filename to manifest
filename = os.path.join(b("sdist_test"), LATIN1_FILENAME)
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 = []
with quiet():
cmd.read_manifest()
# The Latin-1 filename should have been skipped
filename = filename.decode("latin-1")
assert filename not in cmd.filelist.files
开发者ID:haloteam,项目名称:halo,代码行数:29,代码来源:test_sdist.py
示例10: test_defaults_case_sensitivity
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)
assert 'readme.rst' not in manifest, manifest
assert 'setup.py' not in manifest, manifest
assert 'setup.cfg' not in manifest, manifest
开发者ID:Slicer,项目名称:setuptools,代码行数:27,代码来源:test_sdist.py
示例11: test_sdist_with_latin1_encoded_filename
def test_sdist_with_latin1_encoded_filename(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
# Latin-1 filename
filename = os.path.join(b('sdist_test'), LATIN1_FILENAME)
open(filename, 'w').close()
quiet()
try:
cmd.run()
finally:
unquiet()
if sys.version_info >= (3,):
filename = filename.decode('latin-1')
if sys.platform == 'win32':
# Latin-1 is similar to Windows-1252
self.assertTrue(filename in cmd.filelist.files)
else:
# The Latin-1 filename should have been skipped
self.assertFalse(filename in cmd.filelist.files)
else:
# No conversion takes place under Python 2 and the file
# is included. We shall keep it that way for BBB.
self.assertTrue(filename in cmd.filelist.files)
开发者ID:670information,项目名称:SmartCalendar,代码行数:29,代码来源:test_sdist.py
示例12: test_setup_py_exists
def test_setup_py_exists(self):
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'foo.py'
cmd = sdist(dist)
cmd.ensure_finalized()
with quiet():
cmd.run()
manifest = cmd.filelist.files
assert 'setup.py' in manifest
开发者ID:pypa,项目名称:setuptools,代码行数:11,代码来源:test_sdist.py
示例13: test_setup_py_missing
def test_setup_py_missing(self):
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'foo.py'
cmd = sdist(dist)
cmd.ensure_finalized()
if os.path.exists("setup.py"):
os.remove("setup.py")
with quiet():
cmd.run()
manifest = cmd.filelist.files
assert 'setup.py' not in manifest
开发者ID:pypa,项目名称:setuptools,代码行数:13,代码来源:test_sdist.py
示例14: test_setup_py_excluded
def test_setup_py_excluded(self):
with open("MANIFEST.in", "w") as manifest_file:
manifest_file.write("exclude setup.py")
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'foo.py'
cmd = sdist(dist)
cmd.ensure_finalized()
with quiet():
cmd.run()
manifest = cmd.filelist.files
assert 'setup.py' not in manifest
开发者ID:pypa,项目名称:setuptools,代码行数:14,代码来源:test_sdist.py
示例15: test_package_data_in_sdist
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)
开发者ID:ArchAiA,项目名称:skillshare,代码行数:18,代码来源:test_sdist.py
示例16: test_sdist_with_latin1_encoded_filename
def test_sdist_with_latin1_encoded_filename(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
# Latin-1 filename
filename = os.path.join(b('sdist_test'), LATIN1_FILENAME)
open(filename, 'w').close()
self.assertTrue(os.path.isfile(filename))
with quiet():
cmd.run()
if PY3:
# not all windows systems have a default FS encoding of cp1252
if sys.platform == 'win32':
# Latin-1 is similar to Windows-1252 however
# on mbcs filesys it is not in latin-1 encoding
fs_enc = sys.getfilesystemencoding()
if fs_enc == 'mbcs':
filename = filename.decode('mbcs')
else:
filename = filename.decode('latin-1')
self.assertTrue(filename in cmd.filelist.files)
else:
# The Latin-1 filename should have been skipped
filename = filename.decode('latin-1')
self.assertFalse(filename in cmd.filelist.files)
else:
# Under Python 2 there seems to be no decoded string in the
# filelist. However, due to decode and encoding of the
# file name to get utf-8 Manifest the latin1 maybe excluded
try:
# fs_enc should match how one is expect the decoding to
# be proformed for the manifest output.
fs_enc = sys.getfilesystemencoding()
filename.decode(fs_enc)
self.assertTrue(filename in cmd.filelist.files)
except UnicodeDecodeError:
self.assertFalse(filename in cmd.filelist.files)
开发者ID:ArchAiA,项目名称:skillshare,代码行数:43,代码来源:test_sdist.py
示例17: test_manifest_is_read_with_utf8_encoding
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()
# UTF-8 filename
filename = os.path.join('sdist_test', 'smörbröd.py')
open(filename, 'w').close()
quiet()
try:
cmd.run()
finally:
unquiet()
# The filelist should contain the UTF-8 filename
if sys.platform == 'darwin':
filename = decompose(filename)
self.assertTrue(filename in cmd.filelist.files)
开发者ID:CfABrigadePhiladelphia,项目名称:Wikidelphia,代码行数:21,代码来源:test_sdist.py
示例18: test_package_data_in_sdist
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)
开发者ID:JordanGraves,项目名称:AchievementUnlocked-AppEngine,代码行数:22,代码来源:test_sdist.py
示例19: test_sdist_with_latin1_encoded_filename
def test_sdist_with_latin1_encoded_filename(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
# Latin-1 filename
filename = os.path.join(b('sdist_test'), LATIN1_FILENAME)
open(filename, 'w').close()
self.assertTrue(os.path.isfile(filename))
quiet()
try:
cmd.run()
finally:
unquiet()
if sys.version_info >= (3,):
#not all windows systems have a default FS encoding of cp1252
if sys.platform == 'win32':
# Latin-1 is similar to Windows-1252 however
# on mbcs filesys it is not in latin-1 encoding
fs_enc = sys.getfilesystemencoding()
if fs_enc == 'mbcs':
filename = filename.decode('mbcs')
else:
filename = filename.decode('latin-1')
self.assertTrue(filename in cmd.filelist.files)
else:
# The Latin-1 filename should have been skipped
filename = filename.decode('latin-1')
self.assertFalse(filename in cmd.filelist.files)
else:
# No conversion takes place under Python 2 and the file
# is included. We shall keep it that way for BBB.
self.assertTrue(filename in cmd.filelist.files)
开发者ID:adamjberg,项目名称:finna-be-octo-ninja,代码行数:38,代码来源:test_sdist.py
示例20: test_sdist_with_latin1_encoded_filename
def test_sdist_with_latin1_encoded_filename(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
# Latin-1 filename
filename = os.path.join(b('sdist_test'), LATIN1_FILENAME)
open(filename, 'w').close()
quiet()
try:
cmd.run()
finally:
unquiet()
# The filelist should contain the Latin-1 filename
# (in one representation or other)
if sys.platform == 'darwin':
filename = hfs_quote(filename)
elif sys.version_info >= (3,):
filename = filename.decode(sys.getfilesystemencoding(), 'surrogateescape')
self.assertTrue(filename in cmd.filelist.files)
开发者ID:CfABrigadePhiladelphia,项目名称:Wikidelphia,代码行数:24,代码来源:test_sdist.py
注:本文中的setuptools.command.sdist.sdist函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论