本文整理汇总了Python中mozpack.manifests.InstallManifest.add_copy方法的典型用法代码示例。如果您正苦于以下问题:Python InstallManifest.add_copy方法的具体用法?Python InstallManifest.add_copy怎么用?Python InstallManifest.add_copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mozpack.manifests.InstallManifest
的用法示例。
在下文中一共展示了InstallManifest.add_copy方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _manifest_for_project
# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_copy [as 别名]
def _manifest_for_project(self, srcdir, project):
manifest = InstallManifest()
if project.manifest:
manifest.add_copy(mozpath.join(srcdir, project.manifest), 'AndroidManifest.xml')
if project.res:
manifest.add_symlink(mozpath.join(srcdir, project.res), 'res')
else:
# Eclipse expects a res directory no matter what, so we
# make an empty directory if the project doesn't specify.
res = os.path.abspath(mozpath.join(os.path.dirname(__file__),
'templates', 'android_eclipse_empty_resource_directory'))
manifest.add_pattern_copy(res, '.**', 'res')
if project.assets:
manifest.add_symlink(mozpath.join(srcdir, project.assets), 'assets')
for cpe in project._classpathentries:
manifest.add_symlink(mozpath.join(srcdir, cpe.srcdir), cpe.dstdir)
# JARs and native libraries go in the same place. For now,
# we're adding class path entries with the full path to
# required JAR files (which makes sense for JARs in the source
# directory, but probably doesn't for JARs in the object
# directory). This could be a problem because we only know
# the contents of (a subdirectory of) libs/ after a successful
# build and package, which is after build-backend time. So we
# use a pattern symlink that is resolved at manifest install
# time.
if project.libs:
manifest.add_pattern_copy(mozpath.join(srcdir, project.libs), '**', 'libs')
return manifest
示例2: _manifest_for_project
# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_copy [as 别名]
def _manifest_for_project(self, srcdir, project):
manifest = InstallManifest()
if project.manifest:
manifest.add_copy(mozpath.join(srcdir, project.manifest), 'AndroidManifest.xml')
if project.res:
manifest.add_symlink(mozpath.join(srcdir, project.res), 'res')
else:
# Eclipse expects a res directory no matter what, so we
# make an empty directory if the project doesn't specify.
res = os.path.abspath(mozpath.join(os.path.dirname(__file__),
'templates', 'android_eclipse_empty_resource_directory'))
manifest.add_pattern_copy(res, '.**', 'res')
if project.assets:
manifest.add_symlink(mozpath.join(srcdir, project.assets), 'assets')
for cpe in project._classpathentries:
manifest.add_symlink(mozpath.join(srcdir, cpe.srcdir), cpe.dstdir)
# JARs and native libraries go in the same place. For now, we're adding
# class path entries with the full path to required JAR files (which
# makes sense for JARs in the source directory, but probably doesn't for
# JARs in the object directory). This could be a problem because we only
# know the contents of (a subdirectory of) libs/ after a successful
# build and package, which is after build-backend time. At the cost of
# some flexibility, we explicitly copy certain libraries here; if the
# libraries aren't present -- namely, when the tree hasn't been packaged
# -- this fails. That's by design, to avoid crashes on device caused by
# missing native libraries.
for src, dst in project.libs:
manifest.add_copy(mozpath.join(srcdir, src), dst)
return manifest
示例3: _get_test_manifest
# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_copy [as 别名]
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")
return m
示例4: _manifest_for_project
# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_copy [as 别名]
def _manifest_for_project(self, srcdir, project):
manifest = InstallManifest()
if project.manifest:
manifest.add_copy(mozpath.join(srcdir, project.manifest), 'AndroidManifest.xml')
if project.res:
manifest.add_symlink(mozpath.join(srcdir, project.res), 'res')
if project.assets:
manifest.add_symlink(mozpath.join(srcdir, project.assets), 'assets')
for cpe in project._classpathentries:
manifest.add_symlink(mozpath.join(srcdir, cpe.srcdir), cpe.dstdir)
# JARs and native libraries go in the same place. For now,
# we're adding class path entries with the full path to
# required JAR files (which makes sense for JARs in the source
# directory, but probably doesn't for JARs in the object
# directory). This could be a problem because we only know
# the contents of (a subdirectory of) libs/ after a successful
# build and package, which is after build-backend time. So we
# use a pattern symlink that is resolved at manifest install
# time.
if project.libs:
manifest.add_pattern_copy(mozpath.join(srcdir, project.libs), '**', 'libs')
return manifest
示例5: _get_test_manifest
# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_copy [as 别名]
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
示例6: _get_test_manifest
# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_copy [as 别名]
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_preprocess(self.tmppath('p_source'), 'p_dest', self.tmppath('p_source.pp'), '#', {'FOO':'BAR', 'BAZ':'QUX'})
m.add_required_exists('e_dest')
m.add_optional_exists('o_dest')
m.add_pattern_symlink('ps_base', '*', 'ps_dest')
m.add_pattern_copy('pc_base', '**', 'pc_dest')
return m
示例7: test_or
# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_copy [as 别名]
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)
示例8: test_or
# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_copy [as 别名]
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)
示例9: _get_test_manifest
# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_copy [as 别名]
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_preprocess(
self.tmppath("p_source"), "p_dest", self.tmppath("p_source.pp"), "#", {"FOO": "BAR", "BAZ": "QUX"}
)
m.add_required_exists("e_dest")
m.add_optional_exists("o_dest")
m.add_pattern_symlink("ps_base", "*", "ps_dest")
m.add_pattern_copy("pc_base", "**", "pc_dest")
return m
示例10: test_adds
# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_copy [as 别名]
def test_adds(self):
m = InstallManifest()
m.add_symlink("s_source", "s_dest")
m.add_copy("c_source", "c_dest")
m.add_required_exists("e_dest")
self.assertEqual(len(m), 3)
self.assertIn("s_dest", m)
self.assertIn("c_dest", m)
self.assertIn("e_dest", m)
with self.assertRaises(ValueError):
m.add_symlink("s_other", "s_dest")
with self.assertRaises(ValueError):
m.add_copy("c_other", "c_dest")
with self.assertRaises(ValueError):
m.add_required_exists("e_dest")
示例11: test_adds
# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_copy [as 别名]
def test_adds(self):
m = InstallManifest()
m.add_symlink("s_source", "s_dest")
m.add_copy("c_source", "c_dest")
m.add_required_exists("e_dest")
m.add_optional_exists("o_dest")
m.add_pattern_symlink("ps_base", "ps/*", "ps_dest")
m.add_pattern_copy("pc_base", "pc/**", "pc_dest")
m.add_preprocess("p_source", "p_dest", "p_source.pp")
self.assertEqual(len(m), 7)
self.assertIn("s_dest", m)
self.assertIn("c_dest", m)
self.assertIn("p_dest", m)
self.assertIn("e_dest", m)
self.assertIn("o_dest", m)
with self.assertRaises(ValueError):
m.add_symlink("s_other", "s_dest")
with self.assertRaises(ValueError):
m.add_copy("c_other", "c_dest")
with self.assertRaises(ValueError):
m.add_preprocess("p_other", "p_dest", "p_other.pp")
with self.assertRaises(ValueError):
m.add_required_exists("e_dest")
with self.assertRaises(ValueError):
m.add_optional_exists("o_dest")
with self.assertRaises(ValueError):
m.add_pattern_symlink("ps_base", "ps/*", "ps_dest")
with self.assertRaises(ValueError):
m.add_pattern_copy("pc_base", "pc/**", "pc_dest")
示例12: TestInstallManifest
# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_copy [as 别名]
class TestInstallManifest(HelperMixin, unittest.TestCase):
def setUp(self):
HelperMixin.setUp(self)
self.srcdir = os.path.join(self.test_dir, 'src')
os.mkdir(self.srcdir)
self.objdir = os.path.join(self.test_dir, 'obj')
os.mkdir(self.objdir)
self.manifest = InstallManifest()
self.canonical_mapping = {}
for s in ['src1', 'src2']:
srcfile = os.path.join(self.srcdir, s)
objfile = os.path.join(self.objdir, s)
self.canonical_mapping[objfile] = srcfile
self.manifest.add_copy(srcfile, s)
self.manifest_file = os.path.join(self.test_dir, 'install-manifest')
self.manifest.write(self.manifest_file)
def testMakeFileMapping(self):
'''
Test that valid arguments are validated.
'''
arg = '%s,%s' % (self.manifest_file, self.objdir)
ret = symbolstore.validate_install_manifests([arg])
self.assertEqual(len(ret), 1)
manifest, dest = ret[0]
self.assertTrue(isinstance(manifest, InstallManifest))
self.assertEqual(dest, self.objdir)
file_mapping = symbolstore.make_file_mapping(ret)
for obj, src in self.canonical_mapping.iteritems():
self.assertTrue(obj in file_mapping)
self.assertEqual(file_mapping[obj], src)
def testMissingFiles(self):
'''
Test that missing manifest files or install directories give errors.
'''
missing_manifest = os.path.join(self.test_dir, 'missing-manifest')
arg = '%s,%s' % (missing_manifest, self.objdir)
with self.assertRaises(IOError) as e:
symbolstore.validate_install_manifests([arg])
self.assertEqual(e.filename, missing_manifest)
missing_install_dir = os.path.join(self.test_dir, 'missing-dir')
arg = '%s,%s' % (self.manifest_file, missing_install_dir)
with self.assertRaises(IOError) as e:
symbolstore.validate_install_manifests([arg])
self.assertEqual(e.filename, missing_install_dir)
def testBadManifest(self):
'''
Test that a bad manifest file give errors.
'''
bad_manifest = os.path.join(self.test_dir, 'bad-manifest')
with open(bad_manifest, 'wb') as f:
f.write('junk\n')
arg = '%s,%s' % (bad_manifest, self.objdir)
with self.assertRaises(IOError) as e:
symbolstore.validate_install_manifests([arg])
self.assertEqual(e.filename, bad_manifest)
def testBadArgument(self):
'''
Test that a bad manifest argument gives an error.
'''
with self.assertRaises(ValueError) as e:
symbolstore.validate_install_manifests(['foo'])
示例13: TestInstallManifest
# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_copy [as 别名]
class TestInstallManifest(HelperMixin, unittest.TestCase):
def setUp(self):
HelperMixin.setUp(self)
self.srcdir = os.path.join(self.test_dir, "src")
os.mkdir(self.srcdir)
self.objdir = os.path.join(self.test_dir, "obj")
os.mkdir(self.objdir)
self.manifest = InstallManifest()
self.canonical_mapping = {}
for s in ["src1", "src2"]:
srcfile = os.path.join(self.srcdir, s)
objfile = os.path.join(self.objdir, s)
self.canonical_mapping[objfile] = srcfile
self.manifest.add_copy(srcfile, s)
self.manifest_file = os.path.join(self.test_dir, "install-manifest")
self.manifest.write(self.manifest_file)
def testMakeFileMapping(self):
"""
Test that valid arguments are validated.
"""
arg = "%s,%s" % (self.manifest_file, self.objdir)
ret = symbolstore.validate_install_manifests([arg])
self.assertEqual(len(ret), 1)
manifest, dest = ret[0]
self.assertTrue(isinstance(manifest, InstallManifest))
self.assertEqual(dest, self.objdir)
file_mapping = symbolstore.make_file_mapping(ret)
for obj, src in self.canonical_mapping.iteritems():
self.assertTrue(obj in file_mapping)
self.assertEqual(file_mapping[obj], src)
def testMissingFiles(self):
"""
Test that missing manifest files or install directories give errors.
"""
missing_manifest = os.path.join(self.test_dir, "missing-manifest")
arg = "%s,%s" % (missing_manifest, self.objdir)
with self.assertRaises(IOError) as e:
symbolstore.validate_install_manifests([arg])
self.assertEqual(e.filename, missing_manifest)
missing_install_dir = os.path.join(self.test_dir, "missing-dir")
arg = "%s,%s" % (self.manifest_file, missing_install_dir)
with self.assertRaises(IOError) as e:
symbolstore.validate_install_manifests([arg])
self.assertEqual(e.filename, missing_install_dir)
def testBadManifest(self):
"""
Test that a bad manifest file give errors.
"""
bad_manifest = os.path.join(self.test_dir, "bad-manifest")
with open(bad_manifest, "wb") as f:
f.write("junk\n")
arg = "%s,%s" % (bad_manifest, self.objdir)
with self.assertRaises(IOError) as e:
symbolstore.validate_install_manifests([arg])
self.assertEqual(e.filename, bad_manifest)
def testBadArgument(self):
"""
Test that a bad manifest argument gives an error.
"""
with self.assertRaises(ValueError) as e:
symbolstore.validate_install_manifests(["foo"])