PageRenderTime 37ms CodeModel.GetById 26ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

/scripts/check_eggs.py

https://bitbucket.org/cistrome/cistrome-harvard/
Python | 41 lines | 29 code | 5 blank | 7 comment | 2 complexity | 2d4f18cee67a24cec3f8987330fcf0a1 MD5 | raw file
 1#!/usr/bin/env python
 2"""
 3Compares local dependency eggs to those in eggs.ini, displaying a warning if
 4any are out of date.
 5
 6usage: check_eggs.py [options]
 7"""
 8
 9import os, sys, logging
10from optparse import OptionParser
11
12parser = OptionParser()
13parser.add_option( '-c', '--config', dest='config', help='Path to Galaxy config file (universe_wsgi.ini)', default='universe_wsgi.ini' )
14parser.add_option( '-q', '--quiet', dest='quiet', action="store_true", help='Quiet (no output, only set return code)', default=False )
15( options, args ) = parser.parse_args()
16
17if not os.path.exists( options.config ):
18    print "Config file does not exist (see 'python %s --help'): %s" % ( sys.argv[0], options.config )
19    sys.exit( 1 )
20
21root = logging.getLogger()
22root.setLevel( 10 )
23root.addHandler( logging.StreamHandler( sys.stdout ) )
24
25config_arg = ''
26if options.config != 'universe_wsgi.ini':
27    config_arg = '-c %s' % options.config
28
29lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) )
30sys.path.append( lib )
31
32from galaxy.eggs import Crate
33
34c = Crate( options.config )
35if c.config_missing:
36    if not options.quiet:
37        print "Some of your Galaxy eggs are out of date.  Please update them"
38        print "by running:"
39        print "  python scripts/fetch_eggs.py %s" % config_arg
40    sys.exit( 1 )
41sys.exit( 0 )