Files
galaxy/scripts/check_eggs.py
T
John Chilton 01a9e91f39 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.
2014-10-03 01:34:42 -04:00

52 lines
1.5 KiB
Python

#!/usr/bin/env python
"""
Compares local dependency eggs to those in eggs.ini, displaying a warning if
any are out of date.
usage: check_eggs.py [options]
"""
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=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()
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()
root.setLevel( 10 )
root.addHandler( logging.StreamHandler( sys.stdout ) )
config_arg = ''
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( config )
if c.config_missing:
if not options.quiet:
print "Some of your Galaxy eggs are out of date. Please update them"
print "by running:"
print " python scripts/fetch_eggs.py %s" % config_arg
sys.exit( 1 )
sys.exit( 0 )