def run(self): """Run the sqlobject-admin tool or functions from the sacommand module.""" if not "--egg" in sys.argv and not gearshift.util.get_project_name(): print "This doesn't look like a GearShift project." return else: command = sys.argv[1] if config.get("sqlalchemy.dburi"): try: sacommand(command, sys.argv) except Exception: # NoApplicableMethods: # Anonymous except to avoid making entire # gearshift dependent on peak.rules just to get # this ONE case of NoApplicableMethods... sacommand("help", []) return try: from sqlobject.manager import command except ImportError: from gearshift.util import missing_dependency_error print missing_dependency_error('SQLObject') return sqlobjcommand = command if sqlobjcommand not in no_connection_param: if self.dburi: print "Using database URI %s" % self.dburi sys.argv.insert(2, self.dburi) sys.argv.insert(2, "-c") else: print( "Database URI not specified in the config file" " (%s).\nPlease be sure it's on the command line." % (self.config or get_project_config())) if sqlobjcommand not in no_model_param: if not "--egg" in sys.argv: eggname = glob.glob("*.egg-info") if not eggname or not os.path.exists( os.path.join(eggname[0], "sqlobject.txt")): eggname = self.fix_egginfo(eggname) eggname = eggname[0].replace(".egg-info", "") if not "." in sys.path: sys.path.append(".") pkg_resources.working_set.add_entry(".") sys.argv.insert(2, eggname) sys.argv.insert(2, "--egg") command.the_runner.run(sys.argv)
def run(self): """Run the sqlobject-admin tool or functions from the sacommand module.""" if not "--egg" in sys.argv and not gearshift.util.get_project_name(): print "This doesn't look like a GearShift project." return else: command = sys.argv[1] if config.get("sqlalchemy.dburi"): try: sacommand(command, sys.argv) except Exception: # NoApplicableMethods: # Anonymous except to avoid making entire # gearshift dependent on peak.rules just to get # this ONE case of NoApplicableMethods... sacommand("help", []) return try: from sqlobject.manager import command except ImportError: from gearshift.util import missing_dependency_error print missing_dependency_error('SQLObject') return sqlobjcommand = command if sqlobjcommand not in no_connection_param: if self.dburi: print "Using database URI %s" % self.dburi sys.argv.insert(2, self.dburi) sys.argv.insert(2, "-c") else: print ("Database URI not specified in the config file" " (%s).\nPlease be sure it's on the command line." % (self.config or get_project_config())) if sqlobjcommand not in no_model_param: if not "--egg" in sys.argv: eggname = glob.glob("*.egg-info") if not eggname or not os.path.exists( os.path.join(eggname[0], "sqlobject.txt")): eggname = self.fix_egginfo(eggname) eggname = eggname[0].replace(".egg-info", "") if not "." in sys.path: sys.path.append(".") pkg_resources.working_set.add_entry(".") sys.argv.insert(2, eggname) sys.argv.insert(2, "--egg") command.the_runner.run(sys.argv)
def run(self): """Run the sqlobject-admin tool or sacommand module functions.""" if not '--egg' in sys.argv and not get_project_name(): print "This doesn't look like a TurboGears project." return else: command = sys.argv[1] if config.get('sqlalchemy.dburi'): try: sacommand(command, sys.argv) except NoApplicableMethods: sacommand('help', []) return try: from sqlobject.manager import command as socommand except ImportError: from turbogears.util import missing_dependency_error print missing_dependency_error('SQLObject') return if command not in no_connection_param: if self.dburi: print "Using database URI %s" % self.dburi sys.argv.insert(2, self.dburi) sys.argv.insert(2, '-c') else: print ("Database URI not specified in the config file" " (%s).\nPlease be sure it's on the command line." % (self.config or get_project_config())) if command not in no_model_param: if not '--egg' in sys.argv: eggname = glob.glob('*.egg-info') if not eggname or not os.path.exists( os.path.join(eggname[0], 'sqlobject.txt')): eggname = self.fix_egginfo(eggname) eggname = eggname[0].replace('.egg-info', '') if not '.' in sys.path: sys.path.append('.') pkg_resources.working_set.add_entry('.') sys.argv.insert(2, eggname) sys.argv.insert(2, '--egg') socommand.the_runner.run(sys.argv)
def run(self): """Executes the sqlobject-admin code.""" if not "--egg" in sys.argv and not turbogears.util.get_project_name(): print "This don't look like a TurboGears project." return else: command = sys.argv[1] if config.get("sqlalchemy.dburi"): try: sacommand(command, sys.argv) except dispatch.interfaces.NoApplicableMethods: sacommand("help", []) return try: from sqlobject.manager import command as socommand except ImportError: print "Error: SQLObject not installed." return if command not in no_connection_param: if self.dburi: print "Using database URI %s" % self.dburi sys.argv.insert(2, self.dburi) sys.argv.insert(2, "-c") else: print ("Database URI not specified in the config file" " (%s).\nPlease be sure it's on the command line." % (self.config or get_project_config())) if command not in no_model_param: if not "--egg" in sys.argv: eggname = glob.glob("*.egg-info") if not eggname or not os.path.exists( os.path.join(eggname[0], "sqlobject.txt")): eggname = self.fix_egginfo(eggname) eggname = eggname[0].replace(".egg-info", "") if not "." in sys.path: sys.path.append(".") pkg_resources.working_set.add_entry(".") sys.argv.insert(2, eggname) sys.argv.insert(2, "--egg") socommand.the_runner.run(sys.argv)