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


Python Project.init方法代码示例

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


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

示例1: _checkout

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import init [as 别名]
def _checkout(info):
    path = os.path.join(os.getcwd(), info.project)
    if not os.path.exists(path):
        Project.init(path, info.project, info.apiurl)
    packages = []
    if hasattr(info, 'package'):
        packages.append(info.package)
    prj = Project(path, transaction_listener=[MyTransactionListener()])
    prj.update(*packages)
开发者ID:bergmannf,项目名称:osc2,代码行数:11,代码来源:example.py

示例2: _checkout_project

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import init [as 别名]
 def _checkout_project(self, info):
     """Checks out the project project."""
     path = self._path_join(info.project)
     tl = RendererUpdateTransactionListener(self._renderer)
     prj = Project.init(path, info.project, info.apiurl,
                        transaction_listener=[tl])
     self._update_project(prj, info)
开发者ID:scarabeusiv,项目名称:osc2,代码行数:9,代码来源:checkout.py

示例3: _checkout_package

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import init [as 别名]
 def _checkout_package(self, apiurl, project, package, info):
     tl = RendererUpdateTransactionListener(self._renderer)
     path = self._path_join(project)
     if wc_is_project(path):
         prj = Project(path, transaction_listener=[tl])
     else:
         prj = Project.init(path, project, apiurl,
                            transaction_listener=[tl])
     self._update_project(prj, info, package)
开发者ID:scarabeusiv,项目名称:osc2,代码行数:11,代码来源:checkout.py

示例4: test1

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import init [as 别名]
 def test1(self):
     """init a project dir"""
     tmpdir = mkdtemp(dir=self._tmp_dir)
     prj = Project.init(tmpdir, 'openSUSE:Tools',
                        'https://api.opensuse.org')
     prj_fname = os.path.join(tmpdir, '.osc', '_project')
     self.assertTrue(os.path.exists(prj_fname))
     self.assertEqual(open(prj_fname, 'r').read(), 'openSUSE:Tools\n')
     pkgs_fname = os.path.join(tmpdir, '.osc', '_packages')
     self.assertTrue(os.path.exists(pkgs_fname))
     self.assertEqual(open(pkgs_fname, 'r').read(), '<packages/>\n')
     apiurl_fname = os.path.join(tmpdir, '.osc', '_apiurl')
     self.assertTrue(os.path.exists(apiurl_fname))
     self.assertEqual(open(apiurl_fname, 'r').read(),
                      'https://api.opensuse.org\n')
     data_dir = os.path.join(tmpdir, '.osc', 'data')
     self.assertTrue(os.path.exists(data_dir))
     self.assertEqual(prj.name, 'openSUSE:Tools')
     self.assertEqual(prj.apiurl, 'https://api.opensuse.org')
     self.assertTrue(len(prj.packages()) == 0)
     self.assertTrue(len(prj.notifier.listener) == 0)
开发者ID:scarabeusiv,项目名称:osc2,代码行数:23,代码来源:test_project.py

示例5: test1_2

# 需要导入模块: from osc2.wc.project import Project [as 别名]
# 或者: from osc2.wc.project.Project import init [as 别名]
 def test1_2(self):
     """init (pass additional arguments to the Project's __init__ method)"""
     # nearly identical to test1
     tmpdir = mkdtemp(dir=self._tmp_dir)
     prj = Project.init(tmpdir, 'openSUSE:Tools',
                        'https://api.opensuse.org',
                        transaction_listener=[None])
     prj_fname = os.path.join(tmpdir, '.osc', '_project')
     self.assertTrue(os.path.exists(prj_fname))
     self.assertEqual(open(prj_fname, 'r').read(), 'openSUSE:Tools\n')
     pkgs_fname = os.path.join(tmpdir, '.osc', '_packages')
     self.assertTrue(os.path.exists(pkgs_fname))
     self.assertEqual(open(pkgs_fname, 'r').read(), '<packages/>\n')
     apiurl_fname = os.path.join(tmpdir, '.osc', '_apiurl')
     self.assertTrue(os.path.exists(apiurl_fname))
     self.assertEqual(open(apiurl_fname, 'r').read(),
                      'https://api.opensuse.org\n')
     data_dir = os.path.join(tmpdir, '.osc', 'data')
     self.assertTrue(os.path.exists(data_dir))
     self.assertEqual(prj.name, 'openSUSE:Tools')
     self.assertEqual(prj.apiurl, 'https://api.opensuse.org')
     self.assertTrue(len(prj.packages()) == 0)
     self.assertTrue(len(prj.notifier.listener) == 1)
开发者ID:scarabeusiv,项目名称:osc2,代码行数:25,代码来源:test_project.py


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