本文整理汇总了Python中mozpack.manifests.InstallManifest类的典型用法代码示例。如果您正苦于以下问题:Python InstallManifest类的具体用法?Python InstallManifest怎么用?Python InstallManifest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了InstallManifest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_serialization
def test_serialization(self):
m = self._get_test_manifest()
p = self.tmppath('m')
m.write(path=p)
self.assertTrue(os.path.isfile(p))
with open(p, 'rb') as fh:
c = fh.read()
self.assertEqual(c.count('\n'), 9)
lines = c.splitlines()
self.assertEqual(len(lines), 9)
self.assertEqual(lines[0], '5')
m2 = InstallManifest(path=p)
self.assertEqual(m, m2)
p2 = self.tmppath('m2')
m2.write(path=p2)
with open(p2, 'rb') as fh:
c2 = fh.read()
self.assertEqual(c, c2)
示例2: test_serialization
def test_serialization(self):
m = self._get_test_manifest()
p = self.tmppath("m")
m.write(path=p)
self.assertTrue(os.path.isfile(p))
with open(p, "rb") as fh:
c = fh.read()
self.assertEqual(c.count("\n"), 4)
lines = c.splitlines()
self.assertEqual(len(lines), 4)
self.assertEqual(lines[0], "1")
self.assertEqual(lines[1], "2\x1fc_dest\x1f%s" % self.tmppath("c_source"))
self.assertEqual(lines[2], "3\x1fe_dest")
self.assertEqual(lines[3], "1\x1fs_dest\x1f%s" % self.tmppath("s_source"))
m2 = InstallManifest(path=p)
self.assertEqual(m, m2)
p2 = self.tmppath("m2")
m2.write(path=p2)
with open(p2, "rb") as fh:
c2 = fh.read()
self.assertEqual(c, c2)
示例3: test_serialization
def test_serialization(self):
m = self._get_test_manifest()
p = self.tmppath("m")
m.write(path=p)
self.assertTrue(os.path.isfile(p))
with open(p, "rb") as fh:
c = fh.read()
self.assertEqual(c.count("\n"), 8)
lines = c.splitlines()
self.assertEqual(len(lines), 8)
self.assertEqual(lines[0], "4")
m2 = InstallManifest(path=p)
self.assertEqual(m, m2)
p2 = self.tmppath("m2")
m2.write(path=p2)
with open(p2, "rb") as fh:
c2 = fh.read()
self.assertEqual(c, c2)
示例4: test_serialization
def test_serialization(self):
m = self._get_test_manifest()
p = self.tmppath('m')
m.write(path=p)
self.assertTrue(os.path.isfile(p))
with open(p, 'rb') as fh:
c = fh.read()
self.assertEqual(c.count('\n'), 5)
lines = c.splitlines()
self.assertEqual(len(lines), 5)
self.assertEqual(lines[0], '2')
self.assertEqual(lines[1], '2\x1fc_dest\x1f%s' %
self.tmppath('c_source'))
self.assertEqual(lines[2], '3\x1fe_dest')
self.assertEqual(lines[3], '4\x1fo_dest')
self.assertEqual(lines[4], '1\x1fs_dest\x1f%s' %
self.tmppath('s_source'))
m2 = InstallManifest(path=p)
self.assertEqual(m, m2)
p2 = self.tmppath('m2')
m2.write(path=p2)
with open(p2, 'rb') as fh:
c2 = fh.read()
self.assertEqual(c, c2)
示例5: process_manifest
def process_manifest(destdir, *paths):
manifest = InstallManifest()
for path in paths:
manifest |= InstallManifest(path=path)
copier = FileCopier()
manifest.populate_registry(copier)
return copier.copy(destdir)
示例6: process_manifest
def process_manifest(destdir, paths, remove_unaccounted=True):
manifest = InstallManifest()
for path in paths:
manifest |= InstallManifest(path=path)
copier = FileCopier()
manifest.populate_registry(copier)
return copier.copy(destdir, remove_unaccounted=remove_unaccounted)
示例7: test_final_target_files_wildcard
def test_final_target_files_wildcard(self):
"""Ensure that wildcards in FINAL_TARGET_FILES work properly."""
env = self._consume('final-target-files-wildcard', FasterMakeBackend)
m = InstallManifest(path=mozpath.join(env.topobjdir,
'faster', 'install_dist_bin'))
self.assertEqual(len(m), 1)
reg = FileRegistry()
m.populate_registry(reg)
expected = [('foo/bar.xyz', 'bar.xyz'), ('foo/foo.xyz', 'foo.xyz')]
actual = [(path, mozpath.relpath(f.path, env.topsrcdir)) for (path, f) in reg]
self.assertEqual(expected, actual)
示例8: _get_test_manifest
def _get_test_manifest(self):
m = InstallManifest()
m.add_symlink(self.tmppath('s_source'), 's_dest')
m.add_copy(self.tmppath('c_source'), 'c_dest')
m.add_required_exists('e_dest')
m.add_optional_exists('o_dest')
return m
示例9: file_copier
def file_copier(self):
# TODO: invalidate the file copier when the build system
# itself changes, i.e., the underlying unified manifest
# changes.
file_copier = FileCopier()
unified_manifest = InstallManifest(
mozpath.join(self.config_environment.topobjdir,
'faster', 'unified_install_dist_bin'))
unified_manifest.populate_registry(file_copier, defines_override=self.defines)
return file_copier
示例10: test_old_install_manifest_deleted
def test_old_install_manifest_deleted(self):
# Simulate an install manifest from a previous backend version. Ensure
# it is deleted.
env = self._get_environment('stub0')
purge_dir = mozpath.join(env.topobjdir, '_build_manifests', 'install')
manifest_path = mozpath.join(purge_dir, 'old_manifest')
os.makedirs(purge_dir)
m = InstallManifest()
m.write(path=manifest_path)
self.assertTrue(os.path.exists(manifest_path))
self._consume('stub0', RecursiveMakeBackend, env)
self.assertFalse(os.path.exists(manifest_path))
示例11: test_or
def test_or(self):
m1 = self._get_test_manifest()
m2 = InstallManifest()
m2.add_symlink('s_source2', 's_dest2')
m2.add_copy('c_source2', 'c_dest2')
m1 |= m2
self.assertEqual(len(m2), 2)
self.assertEqual(len(m1), 6)
self.assertIn('s_dest2', m1)
self.assertIn('c_dest2', m1)
示例12: test_or
def test_or(self):
m1 = self._get_test_manifest()
m2 = InstallManifest()
m2.add_symlink("s_source2", "s_dest2")
m2.add_copy("c_source2", "c_dest2")
m1 |= m2
self.assertEqual(len(m2), 2)
self.assertEqual(len(m1), 5)
self.assertIn("s_dest2", m1)
self.assertIn("c_dest2", m1)
示例13: find_generated_harness_files
def find_generated_harness_files():
# TEST_HARNESS_FILES end up in an install manifest at
# $topsrcdir/_build_manifests/install/_tests.
manifest = InstallManifest(mozpath.join(buildconfig.topobjdir,
'_build_manifests',
'install',
'_tests'))
registry = FileRegistry()
manifest.populate_registry(registry)
# Conveniently, the generated files we care about will already
# exist in the objdir, so we can identify relevant files if
# they're an `ExistingFile` instance.
return [mozpath.join('_tests', p) for p in registry.paths()
if isinstance(registry[p], ExistingFile)]
示例14: process_manifest
def process_manifest(destdir, paths,
remove_unaccounted=True,
remove_all_directory_symlinks=True,
remove_empty_directories=True):
manifest = InstallManifest()
for path in paths:
manifest |= InstallManifest(path=path)
copier = FileCopier()
manifest.populate_registry(copier)
return copier.copy(destdir,
remove_unaccounted=remove_unaccounted,
remove_all_directory_symlinks=remove_all_directory_symlinks,
remove_empty_directories=remove_empty_directories)
示例15: _synchronize_docs
def _synchronize_docs(self):
m = InstallManifest()
m.add_symlink(self._conf_py_path, "conf.py")
for dest, source in sorted(self._trees.items()):
source_dir = os.path.join(self._topsrcdir, source)
for root, dirs, files in os.walk(source_dir):
for f in files:
source_path = os.path.join(root, f)
rel_source = source_path[len(source_dir) + 1 :]
m.add_symlink(source_path, os.path.join(dest, rel_source))
copier = FileCopier()
m.populate_registry(copier)
copier.copy(self._docs_dir)
with open(self._index_path, "rb") as fh:
data = fh.read()
indexes = ["%s/index" % p for p in sorted(self._trees.keys())]
indexes = "\n ".join(indexes)
packages = [os.path.basename(p) for p in self._python_package_dirs]
packages = ["python/%s" % p for p in packages]
packages = "\n ".join(sorted(packages))
data = data.format(indexes=indexes, python_packages=packages)
with open(os.path.join(self._docs_dir, "index.rst"), "wb") as fh:
fh.write(data)