Created
February 5, 2015 02:23
-
-
Save martenson/f5bc887b1721732991e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- from_file | |
+++ untitled 1 | |
@@ -9,13 +9,22 @@ | |
from optparse import OptionParser | |
parser = OptionParser() | |
-parser.add_option( '-c', '--config', dest='config', help='Path to Galaxy config file (universe_wsgi.ini)', default='universe_wsgi.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 @@ | |
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 @@ | |
print "%s %s is installed at %s" % ( dist.project_name, dist.version, dist.location ) | |
except EggNotFetchable, e: | |
config_arg = '' | |
- if options.config != 'universe_wsgi.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] | |
@@ -66,4 +75,4 @@ | |
for egg in e.eggs: | |
print " python scripts/scramble.py %s-e %s" % ( config_arg, egg.name ) | |
sys.exit( 1 ) | |
-sys.exit( 0 ) | |
+sys.exit( 0 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment