Changeset 1187 in tailor
- Timestamp:
- 06/25/06 16:32:56 (7 years ago)
- Hash name:
- 20060625143256-97f81-d947ea871fb04712bd3b31d25fbca56cd4171e07
- Location:
- vcpx
- Files:
-
- 3 edited
-
repository/__init__.py (modified) (4 diffs)
-
tests/tailor.py (modified) (2 diffs)
-
repository/bzr.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
vcpx/repository/__init__.py
r1185 r1187 30 30 """ 31 31 32 from vcpx .source import InvocationError32 from vcpx import TailorException 33 33 34 34 kind = name[:name.index(':')] … … 40 40 subclass = getattr(concrete, subclassname, klass) 41 41 except SyntaxError, e: 42 self.log.exception("Cannot import %r from %r", kind, modname) 43 raise InvocationError("Cannot import %r: %s" % (kind, e)) 44 except (AttributeError, ImportError), e: 45 self.log.critical("Cannot import %r from %r", kind, modname) 46 if kind == 'bzr': 47 from sys import version_info 48 if version_info < (2,4): 49 self.log.warning("Bazaar-NG backend requires Python 2.4") 50 raise InvocationError("%r is not a known VCS kind: %s" % 51 (self.kind, e)) 42 raise TailorException("Cannot import %r: %s" % (kind, e)) 43 except (AttributeError, ImportError, AssertionError), e: 44 raise TailorException("%r is not a known VCS kind: %s" % (kind, e)) 52 45 instance = super(Repository, klass).__new__(subclass, name, 53 46 project, which) … … 168 161 """ 169 162 170 from vcpx .source import InvocationError163 from vcpx import TailorException 171 164 172 165 wdname = self.kind.capitalize() + 'WorkingDir' … … 177 170 except SyntaxError, e: 178 171 self.log.exception("Cannot import %r from %r", wdname, modname) 179 raise InvocationError("Cannot import %r: %s" % (wdname, e))172 raise TailorException("Cannot import %r: %s" % (wdname, e)) 180 173 except (AttributeError, ImportError), e: 181 174 self.log.critical("Cannot import %r from %r", wdname, modname) 182 if self.kind == 'bzr': 183 from sys import version_info 184 if version_info < (2,4): 185 self.log.warning("Bazaar-NG backend requires Python 2.4") 186 raise InvocationError("%r is not a known VCS kind: %s" % 175 raise TailorException("%r is not a known VCS kind: %s" % 187 176 (self.kind, e)) 188 177 -
vcpx/tests/tailor.py
r1180 r1187 255 255 from unittest import TestCase 256 256 from cStringIO import StringIO 257 from vcpx import TailorException 257 258 from vcpx.config import Config 258 259 from vcpx.tailor import Tailorizer … … 358 359 "Test the BazaarNG source backend" 359 360 361 def testBazaarngAndPython23(self): 362 "Test we detect early when running under Python < 2.4" 363 364 from sys import version_info 365 366 if version_info < (2,4): 367 try: 368 self.tailorize('bazaarng2darcs') 369 except TailorException, e: 370 self.assert_("Bazaar-NG backend requires Python 2.4" 371 in str(e)) 372 else: 373 self.fail("Expected a specific TailorException") 374 360 375 def testBazaarngToDarcs(self): 361 376 "Test bazaar-ng to darcs" 362 377 363 self.tailorize('bazaarng2darcs') 378 try: 379 self.tailorize('bazaarng2darcs') 380 except TailorException, e: 381 from sys import version_info 382 383 if version_info < (2,4): 384 # Under python 2.3 we expect an exception here, but 385 # different from the above: since we are still in a 386 # single python session importing the bzr stuff does 387 # not raise the same error, because from the python 388 # runtime pov the module is already loaded and thus 389 # the second import does not fail. The repository 390 # class will then instantiate the raw Repository 391 # class, not the specific bzr one. Still, when asked 392 # for a working dir, it will fail again 393 self.assert_("object has no attribute 'BzrWorkingDir'" 394 in str(e)) 395 else: 396 raise 397 364 398 365 399 -
vcpx/repository/bzr.py
r1179 r1187 14 14 15 15 __docformat__ = 'reStructuredText' 16 17 18 from sys import version_info 19 assert version_info >= (2,4), "Bazaar-NG backend requires Python 2.4" 20 del version_info 16 21 17 22 from bzrlib.osutils import normpath
Note: See TracChangeset
for help on using the changeset viewer.
