本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)