• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python meta.create_snap_packaging函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中snapcraft.internal.meta.create_snap_packaging函数的典型用法代码示例。如果您正苦于以下问题:Python create_snap_packaging函数的具体用法?Python create_snap_packaging怎么用?Python create_snap_packaging使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_create_meta_with_declared_icon_and_setup

    def test_create_meta_with_declared_icon_and_setup(self):
        fake_logger = fixtures.FakeLogger(level=logging.INFO)
        self.useFixture(fake_logger)

        gui_path = os.path.join('setup', 'gui')
        os.makedirs(gui_path)
        setup_icon_content = b'setup icon'
        with open(os.path.join(gui_path, 'icon.png'), 'wb') as f:
            f.write(setup_icon_content)

        declared_icon_content = b'declared icon'
        with open('my-icon.png', 'wb') as f:
            f.write(declared_icon_content)
        self.config_data['icon'] = 'my-icon.png'

        create_snap_packaging(self.config_data, self.snap_dir, self.parts_dir)

        expected_icon = os.path.join(self.meta_dir, 'gui', 'icon.png')
        self.assertTrue(os.path.exists(expected_icon),
                        'icon.png was not setup correctly')
        with open(expected_icon, 'rb') as f:
            self.assertEqual(f.read(), declared_icon_content)

        self.assertTrue(
            os.path.exists(self.snap_yaml), 'snap.yaml was not created')

        with open(self.snap_yaml) as f:
            y = yaml.load(f)
        self.assertFalse('icon' in y,
                         'icon found in snap.yaml {}'.format(y))
开发者ID:fgimenez,项目名称:snapcraft,代码行数:30,代码来源:test_meta.py


示例2: test_create_meta_with_declared_icon_and_setup

    def test_create_meta_with_declared_icon_and_setup(self):
        fake_logger = fixtures.FakeLogger(level=logging.INFO)
        self.useFixture(fake_logger)

        gui_path = os.path.join('setup', 'gui')
        os.makedirs(gui_path)
        icon_content = b'this is the icon'
        with open(os.path.join(gui_path, 'icon.png'), 'wb') as f:
            f.write(icon_content)

        open(os.path.join(os.curdir, 'my-icon.png'), 'w').close()
        self.config_data['icon'] = 'my-icon.png'

        create_snap_packaging(self.config_data, self.snap_dir, self.parts_dir)

        expected_icon = os.path.join(self.meta_dir, 'gui', 'icon.png')
        self.assertTrue(os.path.exists(expected_icon),
                        'icon.png was not setup correctly')
        with open(expected_icon, 'rb') as f:
            self.assertEqual(f.read(), icon_content)

        self.assertTrue(
            os.path.exists(self.snap_yaml), 'snap.yaml was not created')

        self.assertTrue(
            "DEPRECATED: 'icon' defined in snapcraft.yaml"
            in fake_logger.output, 'Missing deprecation message for icon')

        with open(self.snap_yaml) as f:
            y = yaml.load(f)
        self.assertFalse('icon' in y,
                         'icon found in snap.yaml {}'.format(y))
开发者ID:morphis,项目名称:snapcraft,代码行数:32,代码来源:test_meta.py


示例3: test_create_gadget_meta_with_missing_gadget_yaml_raises_error

    def test_create_gadget_meta_with_missing_gadget_yaml_raises_error(self):
        self.config_data['type'] = 'gadget'

        with self.assertRaises(MissingGadgetError):
            create_snap_packaging(self.config_data,
                                  self.snap_dir,
                                  self.parts_dir)
开发者ID:fgimenez,项目名称:snapcraft,代码行数:7,代码来源:test_meta.py


示例4: generate_meta_yaml

    def generate_meta_yaml(self):
        create_snap_packaging(self.config_data, self.project_options)

        self.assertTrue(
            os.path.exists(self.snap_yaml), 'snap.yaml was not created')

        with open(self.snap_yaml) as f:
            return yaml.load(f)
开发者ID:3v1n0,项目名称:snapcraft,代码行数:8,代码来源:test_meta.py


示例5: _create_meta

 def _create_meta(self, step, part_names):
     if step == steps.PRIME and part_names == self.config.part_names:
         common.env = self.config.snap_env()
         meta.create_snap_packaging(
             self.config.data,
             self.config.parts,
             self.project,
             self.config.validator.schema,
         )
开发者ID:mvo5,项目名称:snapcraft,代码行数:9,代码来源:_runner.py


示例6: test_create_gadget_meta_with_gadget_yaml

    def test_create_gadget_meta_with_gadget_yaml(self):
        gadget_yaml = 'stub entry: stub value'
        _create_file('gadget.yaml', content=gadget_yaml)

        self.config_data['type'] = 'gadget'
        create_snap_packaging(self.config_data, self.project_options, 'dummy')

        expected_gadget = os.path.join(self.meta_dir, 'gadget.yaml')
        self.assertTrue(os.path.exists(expected_gadget))

        self.assertThat(expected_gadget, FileContains(gadget_yaml))
开发者ID:cholcombe973,项目名称:snapcraft,代码行数:11,代码来源:test_meta.py


示例7: test_create_meta_with_app

    def test_create_meta_with_app(self):
        os.mkdir(self.snap_dir)
        open(os.path.join(self.snap_dir, 'app.sh'), 'w').close()
        self.config_data['apps'] = {
            'app1': {'command': 'app.sh'},
            'app2': {'command': 'app.sh', 'plugs': ['network']},
            'app3': {'command': 'app.sh', 'plugs': ['network-server']}
        }
        self.config_data['plugs'] = {
            'network-server': {'interface': 'network-bind'}}

        create_snap_packaging(self.config_data, self.snap_dir, self.parts_dir)

        for app in ['app1', 'app2', 'app3']:
            app_wrapper_path = os.path.join(
                self.snap_dir, 'command-{}.wrapper'.format(app))
            self.assertTrue(
                os.path.exists(app_wrapper_path),
                'the wrapper for {!r} was not setup correctly'.format(app))

        self.assertTrue(
            os.path.exists(self.snap_yaml), 'snap.yaml was not created')

        with open(self.snap_yaml) as f:
            y = yaml.load(f)

        expected = {
            'architectures': ['amd64'],
            'apps': {
                'app1': {
                    'command': 'command-app1.wrapper',
                },
                'app2': {
                    'command': 'command-app2.wrapper',
                    'plugs': ['network'],
                },
                'app3': {
                    'command': 'command-app3.wrapper',
                    'plugs': ['network-server'],
                },
            },
            'description': 'my description',
            'summary': 'my summary',
            'name': 'my-package',
            'version': '1.0',
            'plugs': {
                'network-server': {
                    'interface': 'network-bind',
                }
            }
        }

        self.assertEqual(y, expected)
开发者ID:morphis,项目名称:snapcraft,代码行数:53,代码来源:test_meta.py


示例8: test_create_gadget_meta_with_gadget_yaml

    def test_create_gadget_meta_with_gadget_yaml(self):
        gadget_yaml = 'stub entry: stub value'
        with open(os.path.join('gadget.yaml'), 'w') as f:
            f.write(gadget_yaml)

        self.config_data['type'] = 'gadget'
        create_snap_packaging(self.config_data, self.project_options)

        expected_gadget = os.path.join(self.meta_dir, 'gadget.yaml')
        self.assertTrue(os.path.exists(expected_gadget))

        with open(expected_gadget) as f:
            self.assertEqual(f.read(), gadget_yaml)
开发者ID:3v1n0,项目名称:snapcraft,代码行数:13,代码来源:test_meta.py


示例9: test_create_meta_with_declared_icon_and_setup_ran_twice_ok

    def test_create_meta_with_declared_icon_and_setup_ran_twice_ok(self):
        gui_path = os.path.join('setup', 'gui')
        os.makedirs(gui_path)
        icon_content = 'setup icon'
        _create_file(os.path.join(gui_path, 'icon.png'), content=icon_content)

        _create_file('my-icon.png')
        self.config_data['icon'] = 'my-icon.png'

        create_snap_packaging(self.config_data, self.project_options, 'dummy')

        # Running again should be good
        create_snap_packaging(self.config_data, self.project_options, 'dummy')
开发者ID:cholcombe973,项目名称:snapcraft,代码行数:13,代码来源:test_meta.py


示例10: test_create_meta_with_epoch

    def test_create_meta_with_epoch(self):
        self.config_data['epoch'] = '1*'

        create_snap_packaging(self.config_data, self.snap_dir, self.parts_dir)

        self.assertTrue(
            os.path.exists(self.snap_yaml), 'snap.yaml was not created')

        with open(self.snap_yaml) as f:
            y = yaml.load(f)
        self.assertTrue(
            'epoch' in y,
            'Expected "epoch" property to be copied into snap.yaml')
        self.assertEqual(y['epoch'], '1*')
开发者ID:SamYaple,项目名称:snapcraft,代码行数:14,代码来源:test_meta.py


示例11: test_create_meta_with_declared_icon_and_setup_ran_twice_ok

    def test_create_meta_with_declared_icon_and_setup_ran_twice_ok(self):
        gui_path = os.path.join('setup', 'gui')
        os.makedirs(gui_path)
        icon_content = b'this is the icon'
        with open(os.path.join(gui_path, 'icon.png'), 'wb') as f:
            f.write(icon_content)

        open(os.path.join(os.curdir, 'my-icon.png'), 'w').close()
        self.config_data['icon'] = 'my-icon.png'

        create_snap_packaging(self.config_data, self.snap_dir, self.parts_dir)

        # Running again should be good
        create_snap_packaging(self.config_data, self.snap_dir, self.parts_dir)
开发者ID:morphis,项目名称:snapcraft,代码行数:14,代码来源:test_meta.py


示例12: test_create_meta_with_assumes

    def test_create_meta_with_assumes(self):
        self.config_data['assumes'] = ['feature1', 'feature2']

        create_snap_packaging(self.config_data, self.snap_dir, self.parts_dir)

        self.assertTrue(
            os.path.exists(self.snap_yaml), 'snap.yaml was not created')

        with open(self.snap_yaml) as f:
            y = yaml.load(f)
        self.assertTrue(
            'assumes' in y,
            'Expected "assumes" property to be copied into snap.yaml')
        self.assertEqual(y['assumes'], ['feature1', 'feature2'])
开发者ID:SamYaple,项目名称:snapcraft,代码行数:14,代码来源:test_meta.py


示例13: test_create_meta

    def test_create_meta(self):
        create_snap_packaging(self.config_data, self.snap_dir, self.parts_dir)

        self.assertTrue(
            os.path.exists(self.snap_yaml), 'snap.yaml was not created')

        with open(self.snap_yaml) as f:
            y = yaml.load(f)

        expected = {'architectures': ['amd64'],
                    'description': 'my description',
                    'summary': 'my summary',
                    'name': 'my-package',
                    'version': '1.0'}

        self.assertEqual(y, expected)
开发者ID:morphis,项目名称:snapcraft,代码行数:16,代码来源:test_meta.py


示例14: test_create_meta_with_declared_license

    def test_create_meta_with_declared_license(self):
        open(os.path.join(os.curdir, 'LICENSE'), 'w').close()
        self.config_data['license'] = 'LICENSE'

        create_snap_packaging(self.config_data, self.snap_dir, self.parts_dir)

        self.assertTrue(
            os.path.exists(os.path.join(self.meta_dir, 'license.txt')),
            'license.txt was not setup correctly')

        self.assertTrue(
            os.path.exists(self.snap_yaml), 'snap.yaml was not created')

        with open(self.snap_yaml) as f:
            y = yaml.load(f)
        self.assertFalse('license' in y,
                         'license found in snap.yaml {}'.format(y))
开发者ID:morphis,项目名称:snapcraft,代码行数:17,代码来源:test_meta.py


示例15: test_create_meta_with_declared_icon

    def test_create_meta_with_declared_icon(self):
        open(os.path.join(os.curdir, 'my-icon.png'), 'w').close()
        self.config_data['icon'] = 'my-icon.png'

        create_snap_packaging(self.config_data, self.snap_dir, self.parts_dir)

        self.assertTrue(
            os.path.exists(os.path.join(self.meta_dir, 'gui', 'icon.png')),
            'icon.png was not setup correctly')

        self.assertTrue(
            os.path.exists(self.snap_yaml), 'snap.yaml was not created')

        with open(self.snap_yaml) as f:
            y = yaml.load(f)
        self.assertFalse('icon' in y,
                         'icon found in snap.yaml {}'.format(y))
开发者ID:morphis,项目名称:snapcraft,代码行数:17,代码来源:test_meta.py


示例16: test_create_meta_with_license_in_setup

    def test_create_meta_with_license_in_setup(self):
        os.mkdir('setup')
        license_text = 'this is the license'
        with open(os.path.join('setup', 'license.txt'), 'w') as f:
            f.write(license_text)

        create_snap_packaging(self.config_data, self.snap_dir, self.parts_dir)

        expected_license = os.path.join(self.meta_dir, 'license.txt')
        self.assertTrue(os.path.exists(expected_license),
                        'license.txt was not setup correctly')
        with open(expected_license) as f:
            self.assertEqual(f.read(), license_text)

        self.assertTrue(
            os.path.exists(self.snap_yaml), 'snap.yaml was not created')
        with open(self.snap_yaml) as f:
            y = yaml.load(f)
        self.assertFalse('license' in y,
                         'license found in snap.yaml {}'.format(y))
开发者ID:morphis,项目名称:snapcraft,代码行数:20,代码来源:test_meta.py


示例17: test_create_meta_with_icon_in_setup

    def test_create_meta_with_icon_in_setup(self):
        gui_path = os.path.join('setup', 'gui')
        os.makedirs(gui_path)
        icon_content = b'this is the icon'
        with open(os.path.join(gui_path, 'icon.png'), 'wb') as f:
            f.write(icon_content)

        create_snap_packaging(self.config_data, self.snap_dir, self.parts_dir)

        expected_icon = os.path.join(self.meta_dir, 'gui', 'icon.png')
        self.assertTrue(os.path.exists(expected_icon),
                        'icon.png was not setup correctly')
        with open(expected_icon, 'rb') as f:
            self.assertEqual(f.read(), icon_content)

        self.assertTrue(
            os.path.exists(self.snap_yaml), 'snap.yaml was not created')

        with open(self.snap_yaml) as f:
            y = yaml.load(f)
        self.assertFalse('icon' in y,
                         'icon found in snap.yaml {}'.format(y))
开发者ID:morphis,项目名称:snapcraft,代码行数:22,代码来源:test_meta.py


示例18: test_create_meta_with_confinement

    def test_create_meta_with_confinement(self):
        confinement_types = [
            'strict',
            'devmode',
        ]

        for confinement_type in confinement_types:
            with self.subTest(key=confinement_type):
                self.config_data['confinement'] = confinement_type

                create_snap_packaging(
                    self.config_data, self.snap_dir, self.parts_dir)

                self.assertTrue(
                    os.path.exists(self.snap_yaml),
                    'snap.yaml was not created')

                with open(self.snap_yaml) as f:
                    y = yaml.load(f)
                self.assertTrue(
                    'confinement' in y,
                    'Expected "confinement" property to be in snap.yaml')
                self.assertEqual(y['confinement'], confinement_type)
开发者ID:SamYaple,项目名称:snapcraft,代码行数:23,代码来源:test_meta.py


示例19: test_create_meta_with_grade

    def test_create_meta_with_grade(self):
        grade_types = [
            'stable',
            'devel',
        ]

        for grade_type in grade_types:
            with self.subTest(key=grade_type):
                self.config_data['grade'] = grade_type

                create_snap_packaging(
                    self.config_data, self.snap_dir, self.parts_dir)

                self.assertTrue(
                    os.path.exists(self.snap_yaml),
                    'snap.yaml was not created')

                with open(self.snap_yaml) as f:
                    y = yaml.load(f)
                self.assertTrue(
                    'grade' in y,
                    'Expected "grade" property to be in snap.yaml')
                self.assertEqual(y['grade'], grade_type)
开发者ID:SamYaple,项目名称:snapcraft,代码行数:23,代码来源:test_meta.py


示例20: _create_meta

 def _create_meta(self, step, part_names):
     if step == 'prime' and part_names == self.config.part_names:
         common.env = self.config.snap_env()
         meta.create_snap_packaging(self.config.data,
                                    self.project_options.snap_dir,
                                    self.project_options.parts_dir)
开发者ID:Eroui,项目名称:snapcraft,代码行数:6,代码来源:lifecycle.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python parser.main函数代码示例发布时间:2022-05-27
下一篇:
Python lifecycle.execute函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap