mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Another fix for galaxy.ini being conditionally existent.
Update scripts/check_eggs.py and scripts/fetch_eggs.py with logic to find the correct config file. These files should be refactored so they can share some of this code the way I refactored the database management scripts I guess.
This commit is contained in:
+16
-6
@@ -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"
|
||||
|
||||
+16
-7
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user