[2] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
| 3 | import os, sys, logging, shutil |
---|
| 4 | |
---|
| 5 | root = logging.getLogger() |
---|
| 6 | root.setLevel( 10 ) |
---|
| 7 | root.addHandler( logging.StreamHandler( sys.stdout ) ) |
---|
| 8 | |
---|
| 9 | lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) ) |
---|
| 10 | sys.path.append( lib ) |
---|
| 11 | |
---|
| 12 | from galaxy.eggs import Crate, EggNotFetchable, py |
---|
| 13 | import pkg_resources |
---|
| 14 | |
---|
| 15 | try: |
---|
| 16 | platform = sys.argv[1] |
---|
| 17 | c = Crate( platform = platform ) |
---|
| 18 | print "Platform forced to '%s'" % platform |
---|
| 19 | except: |
---|
| 20 | platform = '-'.join( ( py, pkg_resources.get_platform() ) ) |
---|
| 21 | c = Crate() |
---|
| 22 | print "Using Python interpreter at %s, Version %s" % ( sys.executable, sys.version ) |
---|
| 23 | print "This platform is '%s'" % platform |
---|
| 24 | print "Override with:" |
---|
| 25 | print " make_egg_packager.py <forced-platform>" |
---|
| 26 | |
---|
| 27 | shutil.copy( os.path.join( os.path.dirname( __file__ ), 'egg_packager_template.py' ), 'egg_packager-%s.py' % platform ) |
---|
| 28 | |
---|
| 29 | packager = open( 'egg_packager-%s.py' % platform, 'a' ) |
---|
| 30 | packager.write( "py = '%s'\n" % py ) |
---|
| 31 | packager.write( "url = '%s'\n" % c.repo ) |
---|
| 32 | packager.write( "platform = '%s'\n" % platform ) |
---|
| 33 | packager.write( "dists = [\n" ) |
---|
| 34 | |
---|
| 35 | for egg in c.all_eggs: |
---|
| 36 | if egg.name in c.no_auto: |
---|
| 37 | continue |
---|
| 38 | packager.write( " Distribution( '%s', '%s', '%s', '%s', '%s' ),\n" % ( egg.distribution.egg_name(), egg.distribution.project_name, egg.distribution.version, egg.distribution.py_version, egg.distribution.platform ) ) |
---|
| 39 | |
---|
| 40 | packager.write( """] |
---|
| 41 | |
---|
| 42 | for d in dists: |
---|
| 43 | e = Egg( d ) |
---|
| 44 | if not e.fetch( None ): |
---|
| 45 | failures.append( e ) |
---|
| 46 | |
---|
| 47 | if failures: |
---|
| 48 | print "" |
---|
| 49 | print "Failed:" |
---|
| 50 | for e in failures: |
---|
| 51 | print e.distribution.project_name |
---|
| 52 | else: |
---|
| 53 | create_zip() |
---|
| 54 | clean() |
---|
| 55 | """ ) |
---|
| 56 | |
---|
| 57 | print "Completed packager is 'egg_packager-%s.py'. To" % platform |
---|
| 58 | print "fetch eggs, please copy this file to a system with internet access and run" |
---|
| 59 | print "with:" |
---|
| 60 | print " python egg_packager-%s.py" % platform |
---|