diff --git a/scripts/check_eggs.py b/scripts/check_eggs.py index bb830ee1ba6..e3717069cd4 100644 --- a/scripts/check_eggs.py +++ b/scripts/check_eggs.py @@ -10,12 +10,22 @@ import os, sys, logging from optparse import OptionParser parser = OptionParser() -parser.add_option( '-c', '--config', dest='config', help='Path to Galaxy config file (config/galaxy.ini)', default='config/galaxy.ini' ) +parser.add_option( '-c', '--config', dest='config', help='Path to Galaxy config file (config/galaxy.ini)', default=None ) parser.add_option( '-q', '--quiet', dest='quiet', action="store_true", help='Quiet (no output, only set return code)', default=False ) ( options, args ) = parser.parse_args() -if not os.path.exists( options.config ): - print "Config file does not exist (see 'python %s --help'): %s" % ( sys.argv[0], options.config ) + +config_set = True +config = options.config +if config is None: + config_set = False + for name in ['config/galaxy.ini', 'universe_wsgi.ini', 'config/galaxy.ini.sample']: + if os.path.exists(name): + config = name + break + +if not os.path.exists( config ): + print "Config file does not exist (see 'python %s --help'): %s" % ( sys.argv[0], config ) sys.exit( 1 ) root = logging.getLogger() @@ -23,15 +33,15 @@ root.setLevel( 10 ) root.addHandler( logging.StreamHandler( sys.stdout ) ) config_arg = '' -if options.config != 'config/galaxy.ini': - config_arg = '-c %s' % options.config +if config_set: + config_arg = '-c %s' % config lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) ) sys.path.append( lib ) from galaxy.eggs import Crate -c = Crate( options.config ) +c = Crate( config ) if c.config_missing: if not options.quiet: print "Some of your Galaxy eggs are out of date. Please update them" diff --git a/scripts/fetch_eggs.py b/scripts/fetch_eggs.py index 1b840d9c9d7..f96596f6ee7 100755 --- a/scripts/fetch_eggs.py +++ b/scripts/fetch_eggs.py @@ -9,13 +9,22 @@ import os, sys, logging from optparse import OptionParser parser = OptionParser() -parser.add_option( '-c', '--config', dest='config', help='Path to Galaxy config file (config/galaxy.ini)', default='config/galaxy.ini' ) +parser.add_option( '-c', '--config', dest='config', help='Path to Galaxy config file (config/galaxy.ini)', default=None ) parser.add_option( '-e', '--egg-name', dest='egg_name', help='Egg name (as defined in eggs.ini) to fetch, or "all" for all eggs, even those not needed by your configuration' ) parser.add_option( '-p', '--platform', dest='platform', help='Fetch for a specific platform (by default, eggs are fetched for *this* platform' ) ( options, args ) = parser.parse_args() -if not os.path.exists( options.config ): - print "Config file does not exist (see 'python %s --help'): %s" % ( sys.argv[0], options.config ) +config_set = True +config = options.config +if config is None: + config_set = False + for name in ['config/galaxy.ini', 'universe_wsgi.ini', 'config/galaxy.ini.sample']: + if os.path.exists(name): + config = name + break + +if not os.path.exists( config ): + print "Config file does not exist (see 'python %s --help'): %s" % ( sys.argv[0], config ) sys.exit( 1 ) root = logging.getLogger() @@ -29,9 +38,9 @@ from galaxy.eggs import Crate, EggNotFetchable import pkg_resources if options.platform: - c = Crate( options.config, platform = options.platform ) + c = Crate( config, platform = options.platform ) else: - c = Crate( options.config ) + c = Crate( config ) try: if not options.egg_name: c.resolve() # Only fetch eggs required by the config @@ -49,8 +58,8 @@ try: print "%s %s is installed at %s" % ( dist.project_name, dist.version, dist.location ) except EggNotFetchable, e: config_arg = '' - if options.config != 'config/galaxy.ini': - config_arg = '-c %s ' % options.config + if config_set: + config_arg = '-c %s ' % config try: assert options.egg_name != 'all' egg = e.eggs[0]