mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Remove hardcoding of universe_wsgi.ini, fixes issue #358 (except for the sample cleanup scripts which, as samples, are expected to be modified by the site anyway).
This commit is contained in:
+17
-9
@@ -3,27 +3,35 @@
|
||||
usage: check_eggs.py
|
||||
"""
|
||||
import os, sys, logging
|
||||
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( '-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 )
|
||||
sys.exit( 1 )
|
||||
|
||||
root = logging.getLogger()
|
||||
root.setLevel( 10 )
|
||||
root.addHandler( logging.StreamHandler( sys.stdout ) )
|
||||
|
||||
config_arg = ''
|
||||
if options.config != 'universe_wsgi.ini':
|
||||
config_arg = '-c %s' % options.config
|
||||
|
||||
lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) )
|
||||
sys.path.append( lib )
|
||||
|
||||
try:
|
||||
assert sys.argv[1] == 'quiet'
|
||||
quiet = True
|
||||
except:
|
||||
quiet = False
|
||||
|
||||
from galaxy.eggs import Crate
|
||||
|
||||
c = Crate()
|
||||
c = Crate( options.config )
|
||||
if c.config_missing:
|
||||
if not quiet:
|
||||
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"
|
||||
print " python scripts/fetch_eggs.py %s" % config_arg
|
||||
sys.exit( 1 )
|
||||
sys.exit( 0 )
|
||||
|
||||
+15
-14
@@ -1,11 +1,10 @@
|
||||
"""
|
||||
usage: dist-scramble.py <egg_name> [platform]
|
||||
egg_name - The egg to scramble (as defined in eggs.ini)
|
||||
platform - The platform to scramble on (as defined in
|
||||
dist-eggs.ini). Leave blank for all.
|
||||
Platform-inspecific eggs ignore this argument.
|
||||
"""
|
||||
import os, sys, logging
|
||||
from optparse import OptionParser
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option( '-e', '--egg-name', dest='egg_name', help='Egg name (as defined in eggs.ini) to scramble (required)' )
|
||||
parser.add_option( '-p', '--platform', dest='platform', help='Scramble for a specific platform (by default, eggs are scrambled for all platforms, see dist-eggs.ini for platform names)' )
|
||||
( options, args ) = parser.parse_args()
|
||||
|
||||
root = logging.getLogger()
|
||||
root.setLevel( 10 )
|
||||
@@ -17,18 +16,20 @@ sys.path.append( lib )
|
||||
from galaxy.eggs.dist import DistScrambleCrate, ScrambleFailure
|
||||
from galaxy.eggs import EggNotFetchable
|
||||
|
||||
if len( sys.argv ) > 3 or len( sys.argv ) < 2:
|
||||
print __doc__
|
||||
if not options.egg_name:
|
||||
print "ERROR: You must specify an egg to scramble (-e)"
|
||||
parser.print_help()
|
||||
sys.exit( 1 )
|
||||
elif len( sys.argv ) == 3:
|
||||
c = DistScrambleCrate( sys.argv[2] )
|
||||
|
||||
if options.platform:
|
||||
c = DistScrambleCrate( None, options.platform )
|
||||
else:
|
||||
c = DistScrambleCrate()
|
||||
c = DistScrambleCrate( None )
|
||||
|
||||
try:
|
||||
eggs = c[sys.argv[1]]
|
||||
eggs = c[options.egg_name]
|
||||
except:
|
||||
print "error: %s not in eggs.ini" % sys.argv[1]
|
||||
print "ERROR: %s not in eggs.ini" % options.egg_name
|
||||
sys.exit( 1 )
|
||||
failed = []
|
||||
for egg in eggs:
|
||||
|
||||
+24
-21
@@ -1,15 +1,15 @@
|
||||
"""
|
||||
usage: fetch_eggs.py [egg_name] [platform]
|
||||
With no arguments, fetches all eggs necessary according to the
|
||||
settings in universe_wsgi.ini.
|
||||
egg_name - Fetch only this egg (as defined in eggs.ini) or 'all' for
|
||||
all eggs (even those not required by your settings).
|
||||
platform - Fetch eggs for a specific platform (if not provided, fetch
|
||||
eggs for *this* platform). Useful for fetching eggs for cluster
|
||||
nodes which are of a different architecture than the head node.
|
||||
Platform name can be determined with the get_platforms.py script.
|
||||
"""
|
||||
import os, sys, logging
|
||||
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( '-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 )
|
||||
sys.exit( 1 )
|
||||
|
||||
root = logging.getLogger()
|
||||
root.setLevel( 10 )
|
||||
@@ -21,18 +21,18 @@ sys.path.append( lib )
|
||||
from galaxy.eggs import Crate, EggNotFetchable
|
||||
import pkg_resources
|
||||
|
||||
if options.platform:
|
||||
c = Crate( options.config, platform = options.platform )
|
||||
else:
|
||||
c = Crate( options.config )
|
||||
try:
|
||||
c = Crate( platform = sys.argv[2] )
|
||||
except:
|
||||
c = Crate()
|
||||
try:
|
||||
if len( sys.argv ) == 1:
|
||||
if not options.egg_name:
|
||||
c.resolve() # Only fetch eggs required by the config
|
||||
elif sys.argv[1] == 'all':
|
||||
elif options.egg_name == 'all':
|
||||
c.resolve( all=True ) # Fetch everything
|
||||
else:
|
||||
# Fetch a specific egg
|
||||
name = sys.argv[1]
|
||||
name = options.egg_name
|
||||
try:
|
||||
egg = c[name]
|
||||
except:
|
||||
@@ -41,12 +41,15 @@ try:
|
||||
dist = egg.resolve()[0]
|
||||
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
|
||||
try:
|
||||
assert sys.argv[1] != 'all'
|
||||
assert options.egg_name != 'all'
|
||||
egg = e.eggs[0]
|
||||
print "%s %s couldn't be downloaded automatically. You can try" % ( egg.name, egg.version )
|
||||
print "building it by hand with:"
|
||||
print " python scripts/scramble.py %s"
|
||||
print " python scripts/scramble.py %s-e %s" % ( config_arg, egg.name )
|
||||
except ( AssertionError, IndexError ):
|
||||
print "One or more of the python eggs necessary to run Galaxy couldn't be"
|
||||
print "downloaded automatically. You can try building them by hand (all"
|
||||
@@ -54,6 +57,6 @@ except EggNotFetchable, e:
|
||||
print " python scripts/scramble.py"
|
||||
print "Or individually:"
|
||||
for egg in e.eggs:
|
||||
print " python scripts/scramble.py %s" % egg.name
|
||||
print " python scripts/scramble.py %s-e %s" % ( config_arg, egg.name )
|
||||
sys.exit( 1 )
|
||||
sys.exit( 0 )
|
||||
|
||||
@@ -21,7 +21,15 @@ if sys.argv[-1] in [ 'community' ]:
|
||||
config_file = 'community_wsgi.ini'
|
||||
repo = 'lib/galaxy/webapps/community/model/migrate'
|
||||
else:
|
||||
# Poor man's optparse
|
||||
config_file = 'universe_wsgi.ini'
|
||||
if '-c' in sys.argv:
|
||||
pos = sys.argv.index( '-c' )
|
||||
sys.argv.pop(pos)
|
||||
config_file = sys.argv.pop( pos )
|
||||
if not os.path.exists( config_file ):
|
||||
print "Galaxy config file does not exist (hint: use '-c config.ini' for non-standard locations): %s" % config_file
|
||||
sys.exit( 1 )
|
||||
repo = 'lib/galaxy/model/migrate'
|
||||
|
||||
cp = SafeConfigParser()
|
||||
|
||||
+18
-12
@@ -1,11 +1,14 @@
|
||||
"""
|
||||
usage: scramble.py [egg_name]
|
||||
With no arguments, scrambles all eggs necessary according to the
|
||||
settings in universe_wsgi.ini.
|
||||
egg_name - Scramble only this egg (as defined in eggs.ini) or 'all'
|
||||
for all eggs (even those not required by your settings).
|
||||
"""
|
||||
import os, sys, logging
|
||||
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( '-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' )
|
||||
( 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 )
|
||||
sys.exit( 1 )
|
||||
|
||||
root = logging.getLogger()
|
||||
root.setLevel( 10 )
|
||||
@@ -16,22 +19,25 @@ sys.path.append( lib )
|
||||
|
||||
from galaxy.eggs.scramble import ScrambleCrate, ScrambleFailure, EggNotFetchable
|
||||
|
||||
c = ScrambleCrate()
|
||||
c = ScrambleCrate( options.config )
|
||||
|
||||
try:
|
||||
if len( sys.argv ) == 1:
|
||||
if not options.egg_name:
|
||||
eggs = c.scramble()
|
||||
elif sys.argv[1] == 'all':
|
||||
elif options.egg_name == 'all':
|
||||
c.scramble( all=True )
|
||||
else:
|
||||
# Scramble a specific egg
|
||||
name = sys.argv[1]
|
||||
name = options.egg_name
|
||||
try:
|
||||
egg = c[name]
|
||||
except:
|
||||
print "error: %s not in eggs.ini" % name
|
||||
sys.exit( 1 )
|
||||
for dependency in egg.dependencies:
|
||||
config_arg = ''
|
||||
if options.config != 'universe_wsgi.ini':
|
||||
config_arg = '-c %s' % options.config
|
||||
print "Checking %s dependency: %s" % ( egg.name, dependency )
|
||||
try:
|
||||
c[dependency].require()
|
||||
@@ -39,7 +45,7 @@ try:
|
||||
degg = e.eggs[0]
|
||||
print "%s build dependency %s %s couldn't be downloaded" % ( egg.name, degg.name, degg.version )
|
||||
print "automatically. You can try building it by hand with:"
|
||||
print " python scripts/scramble.py %s" % degg.name
|
||||
print " python scripts/scramble.py %s-e %s" % ( config_agr, degg.name )
|
||||
sys.exit( 1 )
|
||||
egg.scramble()
|
||||
sys.exit( 0 )
|
||||
|
||||
Reference in New Issue
Block a user