本文整理汇总了Python中distutils.filelist.FileList方法的典型用法代码示例。如果您正苦于以下问题:Python filelist.FileList方法的具体用法?Python filelist.FileList怎么用?Python filelist.FileList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distutils.filelist
的用法示例。
在下文中一共展示了filelist.FileList方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from distutils import filelist [as 别名]
# 或者: from distutils.filelist import FileList [as 别名]
def run(self):
# 'filelist' contains the list of files that will make up the
# manifest
self.filelist = FileList()
# Run sub commands
for cmd_name in self.get_sub_commands():
self.run_command(cmd_name)
# Do whatever it takes to get the list of files to process
# (process the manifest template, read an existing manifest,
# whatever). File list is accumulated in 'self.filelist'.
self.get_file_list()
# If user just wanted us to regenerate the manifest, stop now.
if self.manifest_only:
return
# Otherwise, go ahead and create the source distribution tarball,
# or zipfile, or whatever.
self.make_distribution()
示例2: test_include_pattern
# 需要导入模块: from distutils import filelist [as 别名]
# 或者: from distutils.filelist import FileList [as 别名]
def test_include_pattern(self):
# return False if no match
file_list = FileList()
file_list.set_allfiles([])
self.assertFalse(file_list.include_pattern('*.py'))
# return True if files match
file_list = FileList()
file_list.set_allfiles(['a.py', 'b.txt'])
self.assertTrue(file_list.include_pattern('*.py'))
# test * matches all files
file_list = FileList()
self.assertIsNone(file_list.allfiles)
file_list.set_allfiles(['a.py', 'b.txt'])
file_list.include_pattern('*')
self.assertEqual(file_list.allfiles, ['a.py', 'b.txt'])
示例3: run
# 需要导入模块: from distutils import filelist [as 别名]
# 或者: from distutils.filelist import FileList [as 别名]
def run (self):
# 'filelist' contains the list of files that will make up the
# manifest
self.filelist = FileList()
# Ensure that all required meta-data is given; warn if not (but
# don't die, it's not *that* serious!)
self.check_metadata()
# Do whatever it takes to get the list of files to process
# (process the manifest template, read an existing manifest,
# whatever). File list is accumulated in 'self.filelist'.
self.get_file_list()
# If user just wanted us to regenerate the manifest, stop now.
if self.manifest_only:
return
# Otherwise, go ahead and create the source distribution tarball,
# or zipfile, or whatever.
self.make_distribution()
示例4: run
# 需要导入模块: from distutils import filelist [as 别名]
# 或者: from distutils.filelist import FileList [as 别名]
def run(self):
self.filelist = FileList()
self.get_file_list()
make_resource_module(self.filelist.files)
r = super().run()
assert len(self.archive_files) == 1
print("filtering files and recompressing with 4K dictionary")
filter_tar(self.archive_files[0])
outbuf.seek(0)
gzip_4k(outbuf, self.archive_files[0])
return r
# For testing only
示例5: finalize
# 需要导入模块: from distutils import filelist [as 别名]
# 或者: from distutils.filelist import FileList [as 别名]
def finalize(self):
""" complete the files list by processing the given template """
if self.finalized:
return
if self.files == None:
self.files = []
if self.template != None:
if type(self.template) == StringType:
self.template = string.split(self.template,";")
filelist = FileList(self.warn,self.debug_print)
for line in self.template:
filelist.process_template_line(string.strip(line))
filelist.sort()
filelist.remove_duplicates()
self.files.extend(filelist.files)
self.finalized = 1
# end class Data_Files
###########################################################################
# a more sophisticated install routine than distutils install_data
示例6: _check_template
# 需要导入模块: from distutils import filelist [as 别名]
# 或者: from distutils.filelist import FileList [as 别名]
def _check_template(self, content):
dist, cmd = self.get_cmd()
os.chdir(self.tmp_dir)
self.write_file('MANIFEST.in', content)
cmd.ensure_finalized()
cmd.filelist = FileList()
cmd.read_template()
warnings = self.get_logs(WARN)
self.assertEqual(len(warnings), 1)
示例7: test_process_template_line
# 需要导入模块: from distutils import filelist [as 别名]
# 或者: from distutils.filelist import FileList [as 别名]
def test_process_template_line(self):
# testing all MANIFEST.in template patterns
file_list = FileList()
l = make_local_path
# simulated file list
file_list.allfiles = ['foo.tmp', 'ok', 'xo', 'four.txt',
'buildout.cfg',
# filelist does not filter out VCS directories,
# it's sdist that does
l('.hg/last-message.txt'),
l('global/one.txt'),
l('global/two.txt'),
l('global/files.x'),
l('global/here.tmp'),
l('f/o/f.oo'),
l('dir/graft-one'),
l('dir/dir2/graft2'),
l('dir3/ok'),
l('dir3/sub/ok.txt'),
]
for line in MANIFEST_IN.split('\n'):
if line.strip() == '':
continue
file_list.process_template_line(line)
wanted = ['ok',
'buildout.cfg',
'four.txt',
l('.hg/last-message.txt'),
l('global/one.txt'),
l('global/two.txt'),
l('f/o/f.oo'),
l('dir/graft-one'),
l('dir/dir2/graft2'),
]
self.assertEqual(file_list.files, wanted)
示例8: test_debug_print
# 需要导入模块: from distutils import filelist [as 别名]
# 或者: from distutils.filelist import FileList [as 别名]
def test_debug_print(self):
file_list = FileList()
with captured_stdout() as stdout:
file_list.debug_print('xxx')
self.assertEqual(stdout.getvalue(), '')
debug.DEBUG = True
try:
with captured_stdout() as stdout:
file_list.debug_print('xxx')
self.assertEqual(stdout.getvalue(), 'xxx\n')
finally:
debug.DEBUG = False
示例9: test_set_allfiles
# 需要导入模块: from distutils import filelist [as 别名]
# 或者: from distutils.filelist import FileList [as 别名]
def test_set_allfiles(self):
file_list = FileList()
files = ['a', 'b', 'c']
file_list.set_allfiles(files)
self.assertEqual(file_list.allfiles, files)
示例10: test_remove_duplicates
# 需要导入模块: from distutils import filelist [as 别名]
# 或者: from distutils.filelist import FileList [as 别名]
def test_remove_duplicates(self):
file_list = FileList()
file_list.files = ['a', 'b', 'a', 'g', 'c', 'g']
# files must be sorted beforehand (sdist does it)
file_list.sort()
file_list.remove_duplicates()
self.assertEqual(file_list.files, ['a', 'b', 'c', 'g'])
示例11: test_process_template_line
# 需要导入模块: from distutils import filelist [as 别名]
# 或者: from distutils.filelist import FileList [as 别名]
def test_process_template_line(self):
# testing all MANIFEST.in template patterns
file_list = FileList()
# simulated file list
file_list.allfiles = ['foo.tmp', 'ok', 'xo', 'four.txt',
join('global', 'one.txt'),
join('global', 'two.txt'),
join('global', 'files.x'),
join('global', 'here.tmp'),
join('f', 'o', 'f.oo'),
join('dir', 'graft-one'),
join('dir', 'dir2', 'graft2'),
join('dir3', 'ok'),
join('dir3', 'sub', 'ok.txt')
]
for line in MANIFEST_IN.split('\n'):
if line.strip() == '':
continue
file_list.process_template_line(line)
wanted = ['ok', 'four.txt', join('global', 'one.txt'),
join('global', 'two.txt'), join('f', 'o', 'f.oo'),
join('dir', 'graft-one'), join('dir', 'dir2', 'graft2')]
self.assertEqual(file_list.files, wanted)