import argparse
import sys
-import workplace
class Command(object):
)
]
_description = 'Undocumented command'
- _loadWorkplace = True
__C = None
__Wp = None
def __init__(self, config):
self.__C = config
- if self._loadWorkplace:
- self.__Wp = workplace.Workplace()
def argumentError(self, message):
raise CommandArgumentError(message)
@property
def Wp(self):
+ if not self.__Wp:
+ import workplace
+ self.__Wp = workplace.Workplace()
return self.__Wp
print 'Checking integration instances branches'
+ if not self._checkWorkplace():
+ return
+
instances = self.Wp.list(integration=True)
+
for identifier in instances:
M = self.Wp.get(identifier)
stablebranch = M.get('stablebranch')
"""Check that the correct remotes are used"""
print 'Checking remotes'
+
+ if not self._checkWorkplace():
+ return
+
remotes = {
'mine': self.C.get('remotes.mine'),
'stable': self.Wp.getCachedRemote() if self.C.get('useCacheAsUpstreamRemote') else self.C.get('remotes.stable'),
"""Check the wwwroot of the instances"""
print 'Checking wwwroot'
+
+ if not self._checkWorkplace():
+ return
+
instances = self.Wp.resolveMultiple(self.Wp.list())
wwwroot = '%s://%s/' % (self.C.get('scheme'), self.C.get('host'))
if args.fix:
print ' Setting %s on %s' % (expected, M.get('identifier'))
M.updateConfig('wwwroot', expected)
+
+ def _checkWorkplace(self, indent=2):
+ """Returns whether the workplace is available or, and print a message if it is not."""
+ try:
+ self.Wp
+ except ImportError:
+ print ' ' * indent + 'The workplace could not be loaded, did you install the dependencies?'
+ return False
+ return True