本文整理汇总了Python中setuptools.command.egg_info.FileList.process_template_line方法的典型用法代码示例。如果您正苦于以下问题:Python FileList.process_template_line方法的具体用法?Python FileList.process_template_line怎么用?Python FileList.process_template_line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类setuptools.command.egg_info.FileList
的用法示例。
在下文中一共展示了FileList.process_template_line方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_process_template_line
# 需要导入模块: from setuptools.command.egg_info import FileList [as 别名]
# 或者: from setuptools.command.egg_info.FileList import process_template_line [as 别名]
def test_process_template_line(self):
# testing all MANIFEST.in template patterns
file_list = FileList()
ml = make_local_path
# simulated file list
self.make_files([
'foo.tmp', 'ok', 'xo', 'four.txt',
'buildout.cfg',
# filelist does not filter out VCS directories,
# it's sdist that does
ml('.hg/last-message.txt'),
ml('global/one.txt'),
ml('global/two.txt'),
ml('global/files.x'),
ml('global/here.tmp'),
ml('f/o/f.oo'),
ml('dir/graft-one'),
ml('dir/dir2/graft2'),
ml('dir3/ok'),
ml('dir3/sub/ok.txt'),
])
MANIFEST_IN = DALS("""\
include ok
include xo
exclude xo
include foo.tmp
include buildout.cfg
global-include *.x
global-include *.txt
global-exclude *.tmp
recursive-include f *.oo
recursive-exclude global *.x
graft dir
prune dir3
""")
for line in MANIFEST_IN.split('\n'):
if not line:
continue
file_list.process_template_line(line)
wanted = [
'buildout.cfg',
'four.txt',
'ok',
ml('.hg/last-message.txt'),
ml('dir/graft-one'),
ml('dir/dir2/graft2'),
ml('f/o/f.oo'),
ml('global/one.txt'),
ml('global/two.txt'),
]
file_list.sort()
assert file_list.files == wanted
示例2: _get_included_files
# 需要导入模块: from setuptools.command.egg_info import FileList [as 别名]
# 或者: from setuptools.command.egg_info.FileList import process_template_line [as 别名]
def _get_included_files(package_masks):
old_threshold = set_threshold(ERROR)
file_list = FileList()
file_list.extend(_iter_package_modules(package_masks))
manifest = TextFile('MANIFEST.in', strip_comments=1, skip_blanks=1, join_lines=1, lstrip_ws=1, rstrip_ws=1,
collapse_join=1)
for line in manifest.readlines():
file_list.process_template_line(line)
set_threshold(old_threshold)
return file_list.files
示例3: test_process_template_line_invalid
# 需要导入模块: from setuptools.command.egg_info import FileList [as 别名]
# 或者: from setuptools.command.egg_info.FileList import process_template_line [as 别名]
def test_process_template_line_invalid(self):
# invalid lines
file_list = FileList()
for action in ('include', 'exclude', 'global-include',
'global-exclude', 'recursive-include',
'recursive-exclude', 'graft', 'prune', 'blarg'):
try:
file_list.process_template_line(action)
except DistutilsTemplateError:
pass
except Exception:
assert False, "Incorrect error thrown"
else:
assert False, "Should have thrown an error"
示例4: test_prune
# 需要导入模块: from setuptools.command.egg_info import FileList [as 别名]
# 或者: from setuptools.command.egg_info.FileList import process_template_line [as 别名]
def test_prune(self):
ml = make_local_path
# prune
file_list = FileList()
file_list.files = ['a.py', ml('d/b.py'), ml('d/d/e.py'), ml('f/f.py')]
file_list.process_template_line('prune d')
file_list.sort()
assert file_list.files == ['a.py', ml('f/f.py')]
self.assertNoWarnings()
file_list.process_template_line('prune e')
file_list.sort()
assert file_list.files == ['a.py', ml('f/f.py')]
self.assertWarnings()
示例5: test_graft
# 需要导入模块: from setuptools.command.egg_info import FileList [as 别名]
# 或者: from setuptools.command.egg_info.FileList import process_template_line [as 别名]
def test_graft(self):
ml = make_local_path
# graft
file_list = FileList()
self.make_files(['a.py', ml('d/b.py'), ml('d/d/e.py'), ml('f/f.py')])
file_list.process_template_line('graft d')
file_list.sort()
assert file_list.files == [ml('d/b.py'), ml('d/d/e.py')]
self.assertNoWarnings()
file_list.process_template_line('graft e')
file_list.sort()
assert file_list.files == [ml('d/b.py'), ml('d/d/e.py')]
self.assertWarnings()
示例6: test_recursive_exclude
# 需要导入模块: from setuptools.command.egg_info import FileList [as 别名]
# 或者: from setuptools.command.egg_info.FileList import process_template_line [as 别名]
def test_recursive_exclude(self):
ml = make_local_path
# recursive-exclude
file_list = FileList()
file_list.files = ['a.py', ml('d/b.py'), ml('d/c.txt'), ml('d/d/e.py')]
file_list.process_template_line('recursive-exclude d *.py')
file_list.sort()
assert file_list.files == ['a.py', ml('d/c.txt')]
self.assertNoWarnings()
file_list.process_template_line('recursive-exclude e *.py')
file_list.sort()
assert file_list.files == ['a.py', ml('d/c.txt')]
self.assertWarnings()
示例7: test_global_exclude
# 需要导入模块: from setuptools.command.egg_info import FileList [as 别名]
# 或者: from setuptools.command.egg_info.FileList import process_template_line [as 别名]
def test_global_exclude(self):
ml = make_local_path
# global-exclude
file_list = FileList()
file_list.files = ['a.py', 'b.txt', ml('d/c.py')]
file_list.process_template_line('global-exclude *.py')
file_list.sort()
assert file_list.files == ['b.txt']
self.assertNoWarnings()
file_list.process_template_line('global-exclude *.rb')
file_list.sort()
assert file_list.files == ['b.txt']
self.assertWarnings()
示例8: test_include
# 需要导入模块: from setuptools.command.egg_info import FileList [as 别名]
# 或者: from setuptools.command.egg_info.FileList import process_template_line [as 别名]
def test_include(self):
ml = make_local_path
# include
file_list = FileList()
self.make_files(['a.py', 'b.txt', ml('d/c.py')])
file_list.process_template_line('include *.py')
file_list.sort()
assert file_list.files == ['a.py']
self.assertNoWarnings()
file_list.process_template_line('include *.rb')
file_list.sort()
assert file_list.files == ['a.py']
self.assertWarnings()
示例9: test_recursive_include
# 需要导入模块: from setuptools.command.egg_info import FileList [as 别名]
# 或者: from setuptools.command.egg_info.FileList import process_template_line [as 别名]
def test_recursive_include(self):
l = make_local_path
# recursive-include
file_list = FileList()
self.make_files(['a.py', l('d/b.py'), l('d/c.txt'), l('d/d/e.py')])
file_list.process_template_line('recursive-include d *.py')
file_list.sort()
assert file_list.files == [l('d/b.py'), l('d/d/e.py')]
self.assertNoWarnings()
file_list.process_template_line('recursive-include e *.py')
file_list.sort()
assert file_list.files == [l('d/b.py'), l('d/d/e.py')]
self.assertWarnings()
示例10: test_process_template
# 需要导入模块: from setuptools.command.egg_info import FileList [as 别名]
# 或者: from setuptools.command.egg_info.FileList import process_template_line [as 别名]
def test_process_template(self):
l = make_local_path
# invalid lines
file_list = FileList()
for action in ('include', 'exclude', 'global-include',
'global-exclude', 'recursive-include',
'recursive-exclude', 'graft', 'prune', 'blarg'):
try:
file_list.process_template_line(action)
except DistutilsTemplateError:
pass
except Exception:
assert False, "Incorrect error thrown"
else:
assert False, "Should have thrown an error"
# include
file_list = FileList()
file_list.set_allfiles(['a.py', 'b.txt', l('d/c.py')])
file_list.process_template_line('include *.py')
assert file_list.files == ['a.py']
self.assertNoWarnings()
file_list.process_template_line('include *.rb')
assert file_list.files == ['a.py']
self.assertWarnings()
# exclude
file_list = FileList()
file_list.files = ['a.py', 'b.txt', l('d/c.py')]
file_list.process_template_line('exclude *.py')
assert file_list.files == ['b.txt', l('d/c.py')]
self.assertNoWarnings()
file_list.process_template_line('exclude *.rb')
assert file_list.files == ['b.txt', l('d/c.py')]
self.assertWarnings()
# global-include
file_list = FileList()
file_list.set_allfiles(['a.py', 'b.txt', l('d/c.py')])
file_list.process_template_line('global-include *.py')
assert file_list.files == ['a.py', l('d/c.py')]
self.assertNoWarnings()
file_list.process_template_line('global-include *.rb')
assert file_list.files == ['a.py', l('d/c.py')]
self.assertWarnings()
# global-exclude
file_list = FileList()
file_list.files = ['a.py', 'b.txt', l('d/c.py')]
file_list.process_template_line('global-exclude *.py')
assert file_list.files == ['b.txt']
self.assertNoWarnings()
file_list.process_template_line('global-exclude *.rb')
assert file_list.files == ['b.txt']
self.assertWarnings()
# recursive-include
file_list = FileList()
file_list.set_allfiles(['a.py', l('d/b.py'), l('d/c.txt'),
l('d/d/e.py')])
file_list.process_template_line('recursive-include d *.py')
assert file_list.files == [l('d/b.py'), l('d/d/e.py')]
self.assertNoWarnings()
file_list.process_template_line('recursive-include e *.py')
assert file_list.files == [l('d/b.py'), l('d/d/e.py')]
self.assertWarnings()
# recursive-exclude
file_list = FileList()
file_list.files = ['a.py', l('d/b.py'), l('d/c.txt'), l('d/d/e.py')]
file_list.process_template_line('recursive-exclude d *.py')
assert file_list.files == ['a.py', l('d/c.txt')]
self.assertNoWarnings()
file_list.process_template_line('recursive-exclude e *.py')
assert file_list.files == ['a.py', l('d/c.txt')]
self.assertWarnings()
# graft
file_list = FileList()
file_list.set_allfiles(['a.py', l('d/b.py'), l('d/d/e.py'),
l('f/f.py')])
file_list.process_template_line('graft d')
assert file_list.files == [l('d/b.py'), l('d/d/e.py')]
self.assertNoWarnings()
file_list.process_template_line('graft e')
assert file_list.files == [l('d/b.py'), l('d/d/e.py')]
#.........这里部分代码省略.........