本文整理汇总了Python中setuptools.command.egg_info.manifest_maker函数的典型用法代码示例。如果您正苦于以下问题:Python manifest_maker函数的具体用法?Python manifest_maker怎么用?Python manifest_maker使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了manifest_maker函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_write_manifest_skips_non_utf8_filenames
def test_write_manifest_skips_non_utf8_filenames(self):
"""
Files that cannot be encoded to UTF-8 (specifically, those that
weren't originally successfully decoded and have surrogate
escapes) should be omitted from the manifest.
See https://bitbucket.org/tarek/distribute/issue/303 for history.
"""
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
mm = manifest_maker(dist)
mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
os.mkdir('sdist_test.egg-info')
# Latin-1 filename
filename = os.path.join(b'sdist_test', Filenames.latin_1)
# Add filename with surrogates and write manifest
with quiet():
mm.run()
u_filename = filename.decode('utf-8', 'surrogateescape')
mm.filelist.append(u_filename)
# Re-write manifest
mm.write_manifest()
contents = read_all_bytes(mm.manifest)
# The manifest should be UTF-8 encoded
contents.decode('UTF-8')
# The Latin-1 filename should have been skipped
assert posix(filename) not in contents
# The filelist should have been updated as well
assert u_filename not in mm.filelist.files
示例2: test_manifest_is_written_with_utf8_encoding
def test_manifest_is_written_with_utf8_encoding(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
mm = manifest_maker(dist)
mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
os.mkdir('sdist_test.egg-info')
# UTF-8 filename
filename = os.path.join('sdist_test', 'smörbröd.py')
# Must create the file or it will get stripped.
open(filename, 'w').close()
# Add UTF-8 filename and write manifest
with quiet():
mm.run()
mm.filelist.append(filename)
mm.write_manifest()
contents = read_all_bytes(mm.manifest)
# The manifest should be UTF-8 encoded
u_contents = contents.decode('UTF-8')
# The manifest should contain the UTF-8 filename
if six.PY2:
fs_enc = sys.getfilesystemencoding()
filename = filename.decode(fs_enc)
assert posix(filename) in u_contents
示例3: test_write_manifest_allows_utf8_filenames
def test_write_manifest_allows_utf8_filenames(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
mm = manifest_maker(dist)
mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
os.mkdir('sdist_test.egg-info')
filename = os.path.join(b'sdist_test', Filenames.utf_8)
# Must touch the file or risk removal
open(filename, "w").close()
# Add filename and write manifest
with quiet():
mm.run()
u_filename = filename.decode('utf-8')
mm.filelist.files.append(u_filename)
# Re-write manifest
mm.write_manifest()
contents = read_all_bytes(mm.manifest)
# The manifest should be UTF-8 encoded
contents.decode('UTF-8')
# The manifest should contain the UTF-8 filename
assert posix(filename) in contents
# The filelist should have been updated as well
assert u_filename in mm.filelist.files
示例4: test_manifest_is_written_with_utf8_encoding
def test_manifest_is_written_with_utf8_encoding(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
mm = manifest_maker(dist)
mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
os.mkdir('sdist_test.egg-info')
# UTF-8 filename
filename = os.path.join('sdist_test', 'smörbröd.py')
# Add UTF-8 filename and write manifest
quiet()
try:
mm.run()
mm.filelist.files.append(filename)
mm.write_manifest()
finally:
unquiet()
manifest = open(mm.manifest, 'rbU')
contents = manifest.read()
manifest.close()
# The manifest should be UTF-8 encoded
try:
u_contents = contents.decode('UTF-8')
except UnicodeDecodeError, e:
self.fail(e)
示例5: test_write_manifest_skips_non_utf8_filenames
def test_write_manifest_skips_non_utf8_filenames(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
mm = manifest_maker(dist)
mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
os.mkdir('sdist_test.egg-info')
# Latin-1 filename
filename = os.path.join(b('sdist_test'), LATIN1_FILENAME)
# Add filename with surrogates and write manifest
quiet()
try:
mm.run()
u_filename = filename.decode('utf-8', 'surrogateescape')
mm.filelist.files.append(u_filename)
# Re-write manifest
mm.write_manifest()
finally:
unquiet()
manifest = open(mm.manifest, 'rbU')
contents = manifest.read()
manifest.close()
# The manifest should be UTF-8 encoded
try:
contents.decode('UTF-8')
except UnicodeDecodeError, e:
self.fail(e)
示例6: test_manifest_is_written_with_utf8_encoding
def test_manifest_is_written_with_utf8_encoding(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = "setup.py"
mm = manifest_maker(dist)
mm.manifest = os.path.join("sdist_test.egg-info", "SOURCES.txt")
os.mkdir("sdist_test.egg-info")
# UTF-8 filename
filename = os.path.join("sdist_test", "smörbröd.py")
# Add UTF-8 filename and write manifest
quiet()
try:
mm.run()
mm.filelist.files.append(filename)
mm.write_manifest()
finally:
unquiet()
manifest = open(mm.manifest, "rbU")
contents = manifest.read()
manifest.close()
# The manifest should be UTF-8 encoded
try:
u_contents = contents.decode("UTF-8")
except UnicodeDecodeError as e:
self.fail(e)
# The manifest should contain the UTF-8 filename
if sys.version_info >= (3,):
self.assertTrue(posix(filename) in u_contents)
else:
self.assertTrue(posix(filename) in contents)
示例7: test_manifest_is_written_with_surrogateescape_error_handler
def test_manifest_is_written_with_surrogateescape_error_handler(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
mm = manifest_maker(dist)
mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
os.mkdir('sdist_test.egg-info')
# Latin-1 filename
filename = posixpath.join(b('sdist_test'), LATIN1_FILENAME)
# Add filename with surrogates and write manifest
quiet()
try:
mm.run()
if sys.version_info >= (3,):
u = filename.decode('utf-8', 'surrogateescape')
mm.filelist.files.append(u)
else:
mm.filelist.files.append(filename)
mm.write_manifest()
finally:
unquiet()
manifest = open(mm.manifest, 'rbU')
contents = manifest.read()
manifest.close()
# The manifest should contain the Latin-1 filename
self.assertTrue(filename in contents)
示例8: find_sources
def find_sources(path):
import pdb; pdb.set_trace()
dist = find_distributions(path)[0]
mm = manifest_maker(dist)
mm.manifest = None
mm.run()
return mm.filelist
示例9: test_write_manifest_skips_non_utf8_filenames
def test_write_manifest_skips_non_utf8_filenames(self):
"""
Files that cannot be encoded to UTF-8 (specifically, those that
weren't originally successfully decoded and have surrogate
escapes) should be omitted from the manifest.
See https://bitbucket.org/tarek/distribute/issue/303 for history.
"""
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
mm = manifest_maker(dist)
mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
os.mkdir('sdist_test.egg-info')
# Latin-1 filename
filename = os.path.join(b('sdist_test'), LATIN1_FILENAME)
# Add filename with surrogates and write manifest
with quiet():
mm.run()
u_filename = filename.decode('utf-8', 'surrogateescape')
mm.filelist.append(u_filename)
# Re-write manifest
mm.write_manifest()
manifest = open(mm.manifest, 'rbU')
contents = manifest.read()
manifest.close()
# The manifest should be UTF-8 encoded
try:
contents.decode('UTF-8')
except UnicodeDecodeError:
e = sys.exc_info()[1]
self.fail(e)
# The Latin-1 filename should have been skipped
self.assertFalse(posix(filename) in contents)
# The filelist should have been updated as well
self.assertFalse(u_filename in mm.filelist.files)
示例10: test_write_manifest_allows_utf8_filenames
def test_write_manifest_allows_utf8_filenames(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
mm = manifest_maker(dist)
mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
os.mkdir('sdist_test.egg-info')
# UTF-8 filename
filename = os.path.join(b('sdist_test'), b('smörbröd.py'))
# Add filename and write manifest
quiet()
try:
mm.run()
u_filename = filename.decode('utf-8')
mm.filelist.files.append(u_filename)
# Re-write manifest
mm.write_manifest()
finally:
unquiet()
manifest = open(mm.manifest, 'rbU')
contents = manifest.read()
manifest.close()
# The manifest should be UTF-8 encoded
try:
contents.decode('UTF-8')
except UnicodeDecodeError:
e = sys.exc_info()[1]
self.fail(e)
# The manifest should contain the UTF-8 filename
self.assertTrue(posix(filename) in contents)
# The filelist should have been updated as well
self.assertTrue(u_filename in mm.filelist.files)
示例11: test_write_manifest_skips_non_utf8_filenames
def test_write_manifest_skips_non_utf8_filenames(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = "setup.py"
mm = manifest_maker(dist)
mm.manifest = os.path.join("sdist_test.egg-info", "SOURCES.txt")
os.mkdir("sdist_test.egg-info")
# Latin-1 filename
filename = os.path.join(b("sdist_test"), LATIN1_FILENAME)
# Add filename with surrogates and write manifest
quiet()
try:
mm.run()
u_filename = filename.decode("utf-8", "surrogateescape")
mm.filelist.files.append(u_filename)
# Re-write manifest
mm.write_manifest()
finally:
unquiet()
manifest = open(mm.manifest, "rbU")
contents = manifest.read()
manifest.close()
# The manifest should be UTF-8 encoded
try:
contents.decode("UTF-8")
except UnicodeDecodeError:
e = sys.exc_info()[1]
self.fail(e)
# The Latin-1 filename should have been skipped
self.assertFalse(posix(filename) in contents)
# The filelist should have been updated as well
self.assertFalse(u_filename in mm.filelist.files)
示例12: test_manifest_is_written_with_utf8_encoding
def test_manifest_is_written_with_utf8_encoding(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
mm = manifest_maker(dist)
mm.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
os.mkdir('sdist_test.egg-info')
# UTF-8 filename
filename = os.path.join('sdist_test', 'smörbröd.py')
# Must create the file or it will get stripped.
open(filename, 'w').close()
# Add UTF-8 filename and write manifest
with quiet():
mm.run()
mm.filelist.append(filename)
mm.write_manifest()
manifest = open(mm.manifest, 'rbU')
contents = manifest.read()
manifest.close()
# The manifest should be UTF-8 encoded
try:
u_contents = contents.decode('UTF-8')
except UnicodeDecodeError:
e = sys.exc_info()[1]
self.fail(e)
# The manifest should contain the UTF-8 filename
if PY2:
fs_enc = sys.getfilesystemencoding()
filename = filename.decode(fs_enc)
self.assertTrue(posix(filename) in u_contents)
示例13: test_write_manifest_allows_utf8_filenames
def test_write_manifest_allows_utf8_filenames(self):
# Test for #303.
dist = Distribution(SETUP_ATTRS)
dist.script_name = "setup.py"
mm = manifest_maker(dist)
mm.manifest = os.path.join("sdist_test.egg-info", "SOURCES.txt")
os.mkdir("sdist_test.egg-info")
# UTF-8 filename
filename = os.path.join(b("sdist_test"), b("smörbröd.py"))
# Add filename and write manifest
quiet()
try:
mm.run()
u_filename = filename.decode("utf-8")
mm.filelist.files.append(u_filename)
# Re-write manifest
mm.write_manifest()
finally:
unquiet()
manifest = open(mm.manifest, "rbU")
contents = manifest.read()
manifest.close()
# The manifest should be UTF-8 encoded
try:
contents.decode("UTF-8")
except UnicodeDecodeError as e:
self.fail(e)
# The manifest should contain the UTF-8 filename
self.assertTrue(posix(filename) in contents)
# The filelist should have been updated as well
self.assertTrue(u_filename in mm.filelist.files)
示例14: find_sources
def find_sources(path):
dist = find_distributions(path)[0]
mm = manifest_maker(dist)
mm.manifest = None
mm.run()
return mm.filelist