def main(): app = foundation.lay_cement('dmirr', defaults=defaults) from dmirr.cli.bootstrap import base app.setup() try: app.run() except cement_exc.CementSignalError as e: pass except cement_exc.CementRuntimeError as e: print e except exc.dMirrRuntimeError as e: print e except cement_exc.CementArgumentError as e: print e except exc.dMirrArgumentError as e: print e except exc.dMirrAPIError as e: print e except drest.exc.dRestRequestError as e: print "dMirrAPIError => %s" % e.msg except drest.exc.dRestAPIError as e: print "dMirrAPIError => %s" % e.msg finally: app.close()
def test_main(argv=[]): import tempfile app = foundation.lay_cement('dmirr', defaults=defaults, argv=argv) from dmirr.cli.bootstrap import base app.setup() app.run()
def main(): app = foundation.lay_cement('dmirr', defaults=defaults) RETCODE = 0 from dmirr.cli.bootstrap import base app.setup() try: app.run() except cement_exc.CementSignalError as e: pass except cement_exc.CementRuntimeError as e: RETCODE = 1 print e except exc.dMirrRuntimeError as e: RETCODE = 1 print e except cement_exc.CementArgumentError as e: RETCODE = 1 print e except exc.dMirrArgumentError as e: RETCODE = 1 print e except exc.dMirrAPIError as e: RETCODE = 1 data = dict(exception=e.msg, errors=e.errors) try: print app.render(data, 'errors.txt') except IOError as e: print e except drest.exc.dRestRequestError as e: RETCODE = 1 print "dMirrAPIError => %s" % e.msg print e.content except drest.exc.dRestAPIError as e: RETCODE = 1 print "dMirrAPIError => %s" % e.msg finally: app.close() sys.exit(RETCODE)
#!/usr/bin/env python import os import sys from subprocess import Popen, PIPE from cement2.core import foundation, handler, controller app = foundation.lay_cement('dmirr_dev') BASE = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) PKGS = [ 'dmirr.core', 'dmirr.cli', 'dmirr.hub', ] class BaseController(controller.CementBaseController): class Meta: label = 'base' description = 'dMirr Development Utilities' arguments = [ (['package'], dict(action='store', nargs='?', help='a dmirr source package')), (['--clean'], dict(action='store_true', help='clean/reinstall files')), ] def _exec(self, cmd_args): self.log.debug( "Executing: %s" % ' '.join(cmd_args) ) proc = Popen(cmd_args, stdout=PIPE, stderr=PIPE)
#!/usr/bin/env python import os import sys from subprocess import Popen, PIPE from cement2.core import foundation, handler, controller app = foundation.lay_cement('dmirr_dev') BASE = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) PKGS = [ 'dmirr.core', 'dmirr.cli', 'dmirr.hub', ] class BaseController(controller.CementBaseController): class Meta: label = 'base' description = 'dMirr Development Utilities' arguments = [ (['package'], dict(action='store', nargs='?', help='a dmirr source package')), (['--clean'], dict(action='store_true', help='clean/reinstall files')), ] def _exec(self, cmd_args): self.log.debug("Executing: %s" % ' '.join(cmd_args)) proc = Popen(cmd_args, stdout=PIPE, stderr=PIPE)