1 | """ |
---|
2 | usage: dist-scramble.py <egg_name> [platform] |
---|
3 | egg_name - The egg to scramble (as defined in eggs.ini) |
---|
4 | platform - The platform to scramble on (as defined in |
---|
5 | dist-eggs.ini). Leave blank for all. |
---|
6 | Platform-inspecific eggs ignore this argument. |
---|
7 | """ |
---|
8 | import os, sys, logging |
---|
9 | |
---|
10 | root = logging.getLogger() |
---|
11 | root.setLevel( 10 ) |
---|
12 | root.addHandler( logging.StreamHandler( sys.stdout ) ) |
---|
13 | |
---|
14 | lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) ) |
---|
15 | sys.path.append( lib ) |
---|
16 | |
---|
17 | from galaxy.eggs.dist import DistScrambleCrate, ScrambleFailure |
---|
18 | |
---|
19 | if len( sys.argv ) > 3 or len( sys.argv ) < 2: |
---|
20 | print __doc__ |
---|
21 | sys.exit( 1 ) |
---|
22 | elif len( sys.argv ) == 3: |
---|
23 | c = DistScrambleCrate( sys.argv[2] ) |
---|
24 | else: |
---|
25 | c = DistScrambleCrate() |
---|
26 | |
---|
27 | try: |
---|
28 | eggs = c[sys.argv[1]] |
---|
29 | except: |
---|
30 | print "error: %s not in eggs.ini" % sys.argv[1] |
---|
31 | sys.exit( 1 ) |
---|
32 | failed = [] |
---|
33 | for egg in eggs: |
---|
34 | try: |
---|
35 | for dependency in egg.dependencies: |
---|
36 | print "Checking %s dependency: %s" % ( egg.name, dependency ) |
---|
37 | # this could be in a better data structure... |
---|
38 | dep = filter( lambda x: x.platform == egg.platform, c[dependency] )[0] |
---|
39 | dep.resolve() |
---|
40 | except EggNotFetchable, e: |
---|
41 | degg = e.eggs[0] |
---|
42 | print "%s build dependency %s %s %s couldn't be" % ( egg.name, degg.name, degg.version, degg.platform ) |
---|
43 | print "downloaded automatically. There isn't really a graceful" |
---|
44 | print "way to handle this when dist-scrambling." |
---|
45 | failed.append( egg.platform ) |
---|
46 | continue |
---|
47 | try: |
---|
48 | egg.scramble() |
---|
49 | except ScrambleFailure: |
---|
50 | failed.append( egg.platform ) |
---|
51 | if len( failed ): |
---|
52 | print "" |
---|
53 | print "Scramble failed to build eggs on the following platforms (more details" |
---|
54 | print "can be found by reviewing the output above):" |
---|
55 | print "\n".join( failed ) |
---|