PageRenderTime 25ms CodeModel.GetById 14ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

Python | 91 lines | 72 code | 2 blank | 17 comment | 8 complexity | a1322b3f7f585824e877970bad0fba2f MD5 | raw file
 2Scrambles eggs for distribution on multiple platforms.
 5This is mostly designed for use by Galaxy Developers at Penn State who are
 6building eggs for distribution via the Galaxy Eggs distribution site. uses the dist-eggs.ini config file to determine what platforms
 8to build for, and which hosts to build on.
 9 works the same way as ::
12% python scripts/ galaxy_egg
14Called with only the egg argument, will build for all the
15platforms under the all group in its config file (for platform-specific eggs)
16or the noplatform group (for platform-inspecific eggs). The [[hosts]|section
17contains information about which hosts will be used for building on each desired
18platform. If you don't want to build for all the platforms listed under the all
19group, you can add a platform argument (any lvalue in the [hosts]] or [groups]
20section is valid): ::
22% python scripts/ galaxy_egg linux
24The platform argument is ignored for platform-inspecific eggs. An assumption is
25made that your Galaxy distribution is located at the same place on all of the
26hosts on which you're building (i.e. via a network filesystem).
28Once finishes, it will output a list of platforms on which it
29failed to scramble the egg. Successful eggs will be put in a new dist-eggs
30subdirectory of your Galaxy distribution. These eggs can then be copied to your
31distribution site.
34import os, sys, logging
35from optparse import OptionParser
37parser = OptionParser()
38parser.add_option( '-e', '--egg-name', dest='egg_name', help='Egg name (as defined in eggs.ini) to scramble (required)' )
39parser.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)' )
40( options, args ) = parser.parse_args()
42root = logging.getLogger()
43root.setLevel( 10 )
44root.addHandler( logging.StreamHandler( sys.stdout ) )
46lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) )
47sys.path.append( lib )
49from galaxy.eggs.dist import DistScrambleCrate, ScrambleFailure
50from galaxy.eggs import EggNotFetchable
52if not options.egg_name:
53    print "ERROR: You must specify an egg to scramble (-e)"
54    parser.print_help()
55    sys.exit( 1 )
57if options.platform:
58    c = DistScrambleCrate( None, options.platform )
60    c = DistScrambleCrate( None )
63    eggs = c[options.egg_name]
65    print "ERROR: %s not in eggs.ini" % options.egg_name
66    sys.exit( 1 )
67failed = []
68for egg in eggs:
69    try:
70        for dependency in egg.dependencies:
71            print "Checking %s on %s dependency: %s" % (, egg.platform, dependency )
72            # this could be in a better data structure...
73            dep = filter( lambda x: x.platform == egg.platform, c[dependency] )[0]
74            if not os.path.exists( dep.distribution.location ):
75                dep.fetch( dep.distribution.as_requirement() )
76    except EggNotFetchable, e:
77        degg = e.eggs[0]
78        print "%s build dependency %s %s %s couldn't be" % (,, degg.version, degg.platform )
79        print "downloaded automatically.  There isn't really a graceful"
80        print "way to handle this when dist-scrambling."
81        failed.append( egg.platform )
82        continue
83    try:
84        egg.scramble()
85    except ScrambleFailure:
86        failed.append( egg.platform )
87if len( failed ):
88    print ""
89    print "Scramble failed to build eggs on the following platforms (more details"
90    print "can be found by reviewing the output above):"
91    print "\n".join( failed )