コード例 #1
0
 def __init__(self, hub, setupdir, hasvcs=None, setupdir_only=None):
     self.hub = hub
     self.cm_ui = None
     if hasattr(check_manifest, 'UI'):
         self.cm_ui = check_manifest.UI()
     assert setupdir.join("setup.py").check(), setupdir
     hasvcs = not hasvcs and not hub.args.novcs
     setupdir_only = bool(setupdir_only or hub.args.setupdironly)
     if hasvcs:
         with setupdir.as_cwd():
             try:
                 if self.cm_ui:
                     hasvcs = check_manifest.detect_vcs(
                         self.cm_ui).metadata_name
                 else:
                     hasvcs = check_manifest.detect_vcs().metadata_name
             except check_manifest.Failure:
                 hasvcs = None
             else:
                 if hasvcs not in (".hg", ".git") or setupdir_only:
                     # XXX for e.g. svn we don't do copying
                     self.rootpath = setupdir
                 else:
                     for p in setupdir.parts(reverse=True):
                         if p.join(hasvcs).exists():
                             self.rootpath = p
                             break
                     else:
                         hasvcs = None
     self.hasvcs = hasvcs
     self.setupdir = setupdir
     self.setupdir_only = setupdir_only
コード例 #2
0
ファイル: tests.py プロジェクト: fschulze/check-manifest
 def test_detect_vcs_no_vcs(self):
     from check_manifest import detect_vcs, Failure
     with mock.patch('check_manifest.VCS.detect', staticmethod(lambda *a: False)):
         with self.assertRaises(Failure) as cm:
             detect_vcs()
         self.assertEqual(str(cm.exception),
                          "Couldn't find version control data"
                          " (git/hg/bzr/svn supported)")
コード例 #3
0
 def test_detect_vcs_no_vcs(self):
     from check_manifest import detect_vcs, Failure
     with mock.patch('check_manifest.VCS.detect', staticmethod(lambda *a: False)):
         with self.assertRaises(Failure) as cm:
             detect_vcs()
         self.assertEqual(str(cm.exception),
                          "Couldn't find version control data"
                          " (git/hg/bzr/svn supported)")
コード例 #4
0
ファイル: tests.py プロジェクト: rgommers/check-manifest
 def test_detect_git_submodule(self):
     from check_manifest import detect_vcs, Failure
     with self.assertRaises(Failure) as cm:
         detect_vcs()
     self.assertEqual(
         str(cm.exception), "Couldn't find version control data"
         " (git/hg/bzr/svn supported)")
     # now create a .git file like in a submodule
     open(os.path.join(self.tmpdir, '.git'), 'w').close()
     self.assertEqual(detect_vcs().metadata_name, '.git')
コード例 #5
0
ファイル: tests.py プロジェクト: rgommers/check-manifest
 def test_detect_git_submodule(self):
     from check_manifest import detect_vcs, Failure
     with self.assertRaises(Failure) as cm:
         detect_vcs()
     self.assertEqual(str(cm.exception),
                      "Couldn't find version control data"
                      " (git/hg/bzr/svn supported)")
     # now create a .git file like in a submodule
     open(os.path.join(self.tmpdir, '.git'), 'w').close()
     self.assertEqual(detect_vcs().metadata_name, '.git')