Changeset 1125:ac03660da2a7

Show
Ignore:
Timestamp:
03/27/08 15:27:05 (9 months ago)
Author:
Nate Coraor <nate@bx.psu.edu>
branch:
default
convert_revision:
svn:9bcadc22-80f8-0310-8a53-c8f022958886/galaxy/trunk@2484
Message:

The enormous eggs-out-of-svn commit. More details at:

http://g2.trac.bx.psu.edu/wiki/GalaxyEggs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nosetests.sh

    r767 r1125  
    11#!/bin/sh 
    22 
    3 source setup_paths.sh 
     3. ./scripts/get_python.sh 
     4. ./setup_paths.sh 
    45 
    5 export PYTHONPATH=$PYTHONPATH:eggs/NoseHTML-0.2-py2.4.egg 
     6pyver=`$GALAXY_PYTHON -c 'import sys; print sys.version[:3]'` 
     7export PYTHONPATH=$PYTHONPATH:eggs/py$pyver-noplatform/NoseHTML-0.2-py$pyver.egg 
    68 
    7 python2.4 ./scripts/nosetests.py $@ 
     9$GALAXY_PYTHON ./scripts/nosetests.py $@ 
  • run.sh

    r767 r1125  
    11#!/bin/sh 
    22 
    3 source setup_paths.sh 
     3. ./scripts/get_python.sh 
     4. ./setup_paths.sh 
    45 
    56# Create directories 
     
    1516done 
    1617 
    17 python2.4 ./scripts/paster.py serve universe_wsgi.ini $@ 
     18$GALAXY_PYTHON ./scripts/paster.py serve universe_wsgi.ini $@ 
  • scripts/fetch_eggs.py

    r912 r1125  
    1 #!/usr/bin/env python2.4 
    2 """ 
    3 fetch_eggs acquires the eggs necessary to run Galaxy from a central 
    4 repository.  Run without arguments to fetch eggs for the current 
    5 platform, or with a specific platform as an argument. 
     1import sys 
     2from eggs import * 
    63 
    7 For a platform list, see the contents of the directory specified in the 
    8 'repo' variable below.  It takes the basic form of: 
     4config_eggs = ConfigEggs() 
     5galaxy_eggs = GalaxyEggs() 
    96 
    10 python_version-os_name-os_version-cpu_architecture-unicode_size 
     7# "all" argument used to fetch all eggs, for buildbot 
     8if len( sys.argv ) == 2: 
     9    if sys.argv[1] == "all": 
     10        galaxy_config = "all" 
     11    else: 
     12        print "Unknown argument:", sys.argv[1] 
     13        sys.exit( 1 ) 
     14else: 
     15    galaxy_config = GalaxyConfig() 
    1116 
    12 With the notable exception that the os_version is excluded when the 
    13 os_name is Linux.  Mac OS X with Universal MacPython (macpython.org) 
    14 is always python_version-macosx-10.3-fat-ucs2 . 
    15  
    16 Some examples: 
    17  
    18 py2.4-linux-i686-ucs4 (debian, ubuntu 32 bit) 
    19 py2.4-linux-x86_64-ucs2 (rhel, fedora, centos 64 bit) 
    20 py2.4-solaris-2.10-sparc-ucs2 (solaris 10 sparc) 
    21  
    22 check_python_ucs.py in this directory will tell you what UCS is correct 
    23 for your particular python. 
    24 """ 
    25  
    26 repo = "http://eggs.g2.bx.psu.edu" 
    27  
    28 import os, sys, glob 
    29  
    30 def get_egg_platform(): 
    31  
    32     # platform can be specified as an arg 
    33     if len(sys.argv) > 1: 
    34         py = (sys.argv[1].split('-', 1))[0] 
    35         ucs = (sys.argv[1].rsplit('-', 1))[1] 
    36         return ( sys.argv[1], ucs, "%s-noarch" % py ) 
    37  
    38     # else figure it out ourselves 
    39     py = "py%s" % sys.version[0:3] 
    40     if sys.maxunicode > 65535: 
    41         ucs = "ucs4" 
     17missing_eggs = get_missing_eggs( config_eggs, galaxy_eggs, galaxy_config ) 
     18if len( missing_eggs ) != 0: 
     19    ret = fetch_eggs( config_eggs.repo, missing_eggs ) 
     20    if ret == []: 
     21        print "Eggs fetched successfully" 
     22        sys.exit( 0 ) 
    4223    else: 
    43         ucs = "ucs2" 
    44  
    45     from distutils.util import get_platform 
    46     platform = get_platform() 
    47     if platform.startswith('darwin-8'): 
    48         platform = "macosx-10.3-fat" 
    49     full_platform = "%s-%s-%s" % (py, platform, ucs) 
    50  
    51     return (full_platform, ucs, "%s-noarch" % py) 
    52  
    53 def get_eggs( tar=False ): 
    54  
    55     (platform, ucs, noarch) = get_egg_platform() 
    56  
    57     here = os.path.abspath(os.path.dirname(sys.argv[0])) 
    58     if tar: 
    59         eggs = os.path.abspath( "%s/../eggs_dist/%s/eggs" % ( here, platform ) ) 
    60     else: 
    61         eggs = os.path.abspath("%s/../eggs" % here) 
    62     sys.path.append("%s/../lib" % here) 
    63     sys.path.append("%s/../eggs" % here) # twill is here regardless of what eggs is, above 
    64  
    65     import pkg_resources 
    66     pkg_resources.require('twill') 
    67     import twill.commands as tc 
    68     import twill.errors as te 
    69  
    70     if tar: 
    71         import tarfile 
    72  
    73     ucseggs = "%s/%s" % ( eggs, ucs.upper() ) 
    74  
    75     platform_url = "%s/%s" % ( repo, platform ) 
    76     noarch_url = "%s/%s" % ( repo, noarch ) 
    77  
    78     platforms = { platform : ( ucseggs, platform_url ), noarch : ( eggs, noarch_url ) } 
    79     failed_platforms = [] 
    80  
    81     for plat in platforms: 
    82  
    83         print "fetching eggs for %s" % plat 
    84         (eggs, url) = platforms[plat] 
    85  
    86         if not os.path.exists( eggs ): 
    87             try: 
    88                 os.makedirs( eggs ) 
    89             except Exception, e: 
    90                 print "Egg directory creation failed! (details follow):" 
    91                 print e 
    92                 failed_platforms.append(plat) 
    93                 continue 
    94  
    95         try: 
    96             tc.go(url) 
    97             tc.code(200) 
    98         except te.TwillAssertionError, e: 
    99             #print "eggs are not available for this platform (twill error follows):" 
    100             #print e 
    101             print "eggs are not available for this platform (continuing to fetch additional platforms)" 
    102             failed_platforms.append(plat) 
    103             continue 
    104  
    105         for link in tc.get_browser()._browser.links(): 
    106             if not link.url.endswith('.egg'): 
    107                 continue 
    108             if os.path.exists("%s/%s" % ( eggs, link.url )): 
    109                 print "Skipping %s, already exists" % link.url 
    110                 continue 
    111             (pkg, version, rest) = link.url.split('-', 2) 
    112             for old in glob.glob( "%s/%s-*-%s" % ( eggs, pkg, rest ) ): 
    113                 print "Removing differing version of %s: %s" % ( pkg, old ) 
    114                 try: 
    115                     os.unlink( old ) 
    116                 except Exception, e: 
    117                     print "Removal failed! (details follow):" 
    118                     print e 
    119                     sys.exit(1) 
    120             print "Fetching", link.url 
    121             tc.go( "%s/%s" % ( url, link.url ) ) 
    122             tc.code( 200 ) 
    123             tc.save_html( "%s/%s" % ( eggs, link.url ) ) 
    124  
    125     if tar: 
    126         try: 
    127             tfname = os.path.abspath( "%s/../eggs_dist/%s.tar" % ( here, platform ) ) 
    128             t = tarfile.open( tfname, 'w' ) 
    129             os.chdir( "%s/../eggs_dist/%s" % ( here, platform ) ) 
    130             t.add( "eggs" ) 
    131             t.close() 
    132             print "Created egg tarfile:", tfname 
    133         except Exception, e: 
    134             print "Unable to create tarfile (details follow)" 
    135             print e 
    136             sys.exit(1) 
    137  
    138     print "" 
    139     print "WARNING: The script was unable to download eggs for these platforms:" 
    140     print "" 
    141     print "\n".join(failed_platforms) 
    142     print "" 
    143     print "This will probably make Galaxy unusable.  Because of the wide range of" 
    144     print "operating systems and os versions available on which Galaxy will run," 
    145     print "the Galaxy developers are not always able to provide pre-built eggs." 
    146     print "For information on building eggs on your own platform, please see the" 
    147     print "Scramble page on the Galaxy wiki at:" 
    148     print "" 
    149     print "http://g2.trac.bx.psu.edu/wiki/Scramble" 
    150     print "" 
    151     print "or email galaxy-bugs@bx.psu.edu" 
    152     print "" 
    153  
    154 if __name__ == "__main__": 
    155     get_eggs() 
     24        print "" 
     25        print 'fetch_eggs.py was unable to download some eggs.  You may have success' 
     26        print '"scrambling" them yourself:' 
     27        print "" 
     28        for name in ret: 
     29            print " ", sys.executable, os.path.join( os.path.dirname( sys.argv[0] ), "scramble.py" ), name 
     30        print "" 
     31        sys.exit( 1 ) 
     32else: 
     33    print "All eggs are up to date for this revision of Galaxy" 
     34sys.exit( 0 ) 
  • setup_paths.sh

    r1101 r1125  
    88ARCH="$KERNEL-$MACHTYPE" 
    99 
    10 PYTHON_UCS=`./scripts/check_python_ucs.py` 
    11  
    12 echo "Architecture appears to be $ARCH $PYTHON_UCS" 
     10PLATFORMS=`$GALAXY_PYTHON ./scripts/get_platforms.py` 
    1311 
    1412UNIVERSE_HOME=`pwd` 
    15 PYTHONPATH=$UNIVERSE_HOME/lib:$UNIVERSE_HOME/eggs/$PYTHON_UCS:$UNIVERSE_HOME/eggs 
     13PYTHONPATH=$UNIVERSE_HOME/lib 
     14for PLATFORM in $PLATFORMS; do 
     15    echo "Using eggs in $PLATFORM" 
     16    PYTHONPATH=$PYTHONPATH:$UNIVERSE_HOME/eggs/$PLATFORM 
     17done 
     18 
     19$GALAXY_PYTHON ./scripts/check_eggs.py 
     20if [ $? -ne 0 ]; then 
     21    exit 1 
     22fi 
    1623 
    1724export UNIVERSE_HOME PYTHONPATH