当前位置: 首页>>代码示例>>Python>>正文


Python InstallManifest.add_pattern_link方法代码示例

本文整理汇总了Python中mozpack.manifests.InstallManifest.add_pattern_link方法的典型用法代码示例。如果您正苦于以下问题:Python InstallManifest.add_pattern_link方法的具体用法?Python InstallManifest.add_pattern_link怎么用?Python InstallManifest.add_pattern_link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mozpack.manifests.InstallManifest的用法示例。


在下文中一共展示了InstallManifest.add_pattern_link方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_test_manifest

# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_pattern_link [as 别名]
    def _get_test_manifest(self):
        m = InstallManifest()
        m.add_link(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_link('ps_base', '*', 'ps_dest')
        m.add_pattern_copy('pc_base', '**', 'pc_dest')
        m.add_content('the content\non\nmultiple lines', 'content')

        return m
开发者ID:luke-chang,项目名称:gecko-1,代码行数:14,代码来源:test_manifests.py

示例2: test_add_entries_from

# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_pattern_link [as 别名]
    def test_add_entries_from(self):
        source = self.tmppath('source')
        os.mkdir(source)
        os.mkdir('%s/base' % source)
        os.mkdir('%s/base/foo' % source)

        with open('%s/base/foo/file1' % source, 'a'):
            pass

        with open('%s/base/foo/file2' % source, 'a'):
            pass

        m = InstallManifest()
        m.add_pattern_link('%s/base' % source, '**', 'dest')

        p = InstallManifest()
        p.add_entries_from(m)
        self.assertEqual(len(p), 1)

        c = FileCopier()
        p.populate_registry(c)
        self.assertEqual(c.paths(), ['dest/foo/file1', 'dest/foo/file2'])

        q = InstallManifest()
        q.add_entries_from(m, base='target')
        self.assertEqual(len(q), 1)

        d = FileCopier()
        q.populate_registry(d)
        self.assertEqual(d.paths(), ['target/dest/foo/file1', 'target/dest/foo/file2'])

        # Some of the values in an InstallManifest include destination
        # information that is present in the keys.  Verify that we can
        # round-trip serialization.
        r = InstallManifest()
        r.add_entries_from(m)
        r.add_entries_from(m, base='target')
        self.assertEqual(len(r), 2)

        temp_path = self.tmppath('temp_path')
        r.write(path=temp_path)

        s = InstallManifest(path=temp_path)
        e = FileCopier()
        s.populate_registry(e)

        self.assertEqual(e.paths(),
                         ['dest/foo/file1', 'dest/foo/file2',
                          'target/dest/foo/file1', 'target/dest/foo/file2'])
开发者ID:luke-chang,项目名称:gecko-1,代码行数:51,代码来源:test_manifests.py

示例3: test_pattern_expansion

# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_pattern_link [as 别名]
    def test_pattern_expansion(self):
        source = self.tmppath('source')
        os.mkdir(source)
        os.mkdir('%s/base' % source)
        os.mkdir('%s/base/foo' % source)

        with open('%s/base/foo/file1' % source, 'a'):
            pass

        with open('%s/base/foo/file2' % source, 'a'):
            pass

        m = InstallManifest()
        m.add_pattern_link('%s/base' % source, '**', 'dest')

        c = FileCopier()
        m.populate_registry(c)
        self.assertEqual(c.paths(), ['dest/foo/file1', 'dest/foo/file2'])
开发者ID:luke-chang,项目名称:gecko-1,代码行数:20,代码来源:test_manifests.py

示例4: test_process_manifest

# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_pattern_link [as 别名]
    def test_process_manifest(self):
        source = self.tmppath('source')
        os.mkdir(source)
        os.mkdir('%s/base' % source)
        os.mkdir('%s/base/foo' % source)
        os.mkdir('%s/base2' % source)

        with open('%s/base/foo/file1' % source, 'a'):
            pass

        with open('%s/base/foo/file2' % source, 'a'):
            pass

        with open('%s/base2/file3' % source, 'a'):
            pass

        m = InstallManifest()
        m.add_pattern_link('%s/base' % source, '**', '')
        m.add_link('%s/base2/file3' % source, 'foo/file3')

        p = self.tmppath('m')
        m.write(path=p)

        dest = self.tmppath('dest')
        track = self.tmppath('track')

        for i in range(2):
            process_install_manifest.process_manifest(dest, [p], track)

            self.assertTrue(os.path.exists(self.tmppath('dest/foo/file1')))
            self.assertTrue(os.path.exists(self.tmppath('dest/foo/file2')))
            self.assertTrue(os.path.exists(self.tmppath('dest/foo/file3')))

        m = InstallManifest()
        m.write(path=p)

        for i in range(2):
            process_install_manifest.process_manifest(dest, [p], track)

            self.assertFalse(os.path.exists(self.tmppath('dest/foo/file1')))
            self.assertFalse(os.path.exists(self.tmppath('dest/foo/file2')))
            self.assertFalse(os.path.exists(self.tmppath('dest/foo/file3')))
开发者ID:luke-chang,项目名称:gecko-1,代码行数:44,代码来源:test_process_install_manifest.py

示例5: test_adds

# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_pattern_link [as 别名]
    def test_adds(self):
        m = InstallManifest()
        m.add_link('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_link('ps_base', 'ps/*', 'ps_dest')
        m.add_pattern_copy('pc_base', 'pc/**', 'pc_dest')
        m.add_preprocess('p_source', 'p_dest', 'p_source.pp')
        m.add_content('content', 'content')

        self.assertEqual(len(m), 8)
        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)
        self.assertIn('content', m)

        with self.assertRaises(ValueError):
            m.add_link('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_link('ps_base', 'ps/*', 'ps_dest')

        with self.assertRaises(ValueError):
            m.add_pattern_copy('pc_base', 'pc/**', 'pc_dest')

        with self.assertRaises(ValueError):
            m.add_content('content', 'content')
开发者ID:luke-chang,项目名称:gecko-1,代码行数:44,代码来源:test_manifests.py

示例6: test_write_expand_pattern

# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_pattern_link [as 别名]
    def test_write_expand_pattern(self):
        source = self.tmppath('source')
        os.mkdir(source)
        os.mkdir('%s/base' % source)
        os.mkdir('%s/base/foo' % source)

        with open('%s/base/foo/file1' % source, 'a'):
            pass

        with open('%s/base/foo/file2' % source, 'a'):
            pass

        m = InstallManifest()
        m.add_pattern_link('%s/base' % source, '**', 'dest')

        track = self.tmppath('track')
        m.write(path=track, expand_pattern=True)

        m = InstallManifest(path=track)
        self.assertEqual([dest for dest in m._dests],
                         ['dest/foo/file1', 'dest/foo/file2'])
开发者ID:luke-chang,项目名称:gecko-1,代码行数:23,代码来源:test_manifests.py

示例7: test_test_manifest_deffered_installs_written

# 需要导入模块: from mozpack.manifests import InstallManifest [as 别名]
# 或者: from mozpack.manifests.InstallManifest import add_pattern_link [as 别名]
    def test_test_manifest_deffered_installs_written(self):
        """Shared support files are written to their own data file by the backend."""
        env = self._consume('test-manifest-shared-support', RecursiveMakeBackend)

        # First, read the generated for ini manifest contents.
        test_files_manifest = mozpath.join(env.topobjdir,
                                           '_build_manifests',
                                           'install',
                                           '_test_files')
        m = InstallManifest(path=test_files_manifest)

        # Then, synthesize one from the test-installs.pkl file. This should
        # allow us to re-create a subset of the above.
        env = self._consume('test-manifest-shared-support', TestManifestBackend)
        test_installs_path = mozpath.join(env.topobjdir, 'test-installs.pkl')

        with open(test_installs_path, 'r') as fh:
            test_installs = pickle.load(fh)

        self.assertEqual(set(test_installs.keys()),
                         set(['child/test_sub.js',
                              'child/data/**',
                              'child/another-file.sjs']))
        for key in test_installs.keys():
            self.assertIn(key, test_installs)

        synthesized_manifest = InstallManifest()
        for item, installs in test_installs.items():
            for install_info in installs:
                if len(install_info) == 3:
                    synthesized_manifest.add_pattern_link(*install_info)
                if len(install_info) == 2:
                    synthesized_manifest.add_link(*install_info)

        self.assertEqual(len(synthesized_manifest), 3)
        for item, info in synthesized_manifest._dests.items():
            self.assertIn(item, m)
            self.assertEqual(info, m._dests[item])
开发者ID:luke-chang,项目名称:gecko-1,代码行数:40,代码来源:test_recursivemake.py


注:本文中的mozpack.manifests.InstallManifest.add_pattern_link方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。