Example #1
0
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)
Example #2
0
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)
Example #3
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)
Example #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)
Example #5
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)
Example #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)
Example #7
0
 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)
Example #8
0
 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)
Example #9
0
 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)
Example #10
0
 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)