コード例 #1
0
ファイル: example.py プロジェクト: vikas-lamba/osc2
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
0
ファイル: example.py プロジェクト: bergmannf/osc2
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)
コード例 #3
0
ファイル: checkout.py プロジェクト: scarabeusiv/osc2
 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)
コード例 #4
0
 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)
コード例 #5
0
ファイル: checkout.py プロジェクト: scarabeusiv/osc2
 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)
コード例 #6
0
 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)
コード例 #7
0
ファイル: test_project.py プロジェクト: scarabeusiv/osc2
 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)
コード例 #8
0
ファイル: test_project.py プロジェクト: vikas-lamba/osc2
 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)
コード例 #9
0
ファイル: test_project.py プロジェクト: scarabeusiv/osc2
 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)
コード例 #10
0
ファイル: test_project.py プロジェクト: vikas-lamba/osc2
 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)