Changeset 12846


Ignore:
Timestamp:
07/31/12 18:01:11 (13 years ago)
Author:
glperez
Message:

Major changes to the DownloadExternalPackage.py script.

Location:
issm/trunk-jpl
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/externalpackages/android/android_aux.sh

    r12738 r12846  
    2222        step=${BASH_REMATCH[1]};
    2323        echo "Setting step to: " $step
    24     elif [[ "$arg" =~ -j=([0-9])* ]]; then
     24    elif [[ "$arg" =~ -j=([1-9]+[0-9]*) || "$arg" =~ ([1-9]+[0-9]*) ]]; then
    2525        j=${BASH_REMATCH[1]};
    2626        echo "Number of jobs set to: " $j
  • TabularUnified issm/trunk-jpl/externalpackages/gsl/install-android.sh

    r12738 r12846  
    2424    cd src
    2525   
    26     autoreconf -iv --force -I "$ISSM_DIR/m4/"
     26    autoreconf -iv --force -I $LIBTOOL_DIR/share/aclocal/
    2727
    2828    ./configure \
     
    3535if [[ $step == "3" || $step == "0" ]]; then
    3636    if [ -z $1 ]; then
    37             make 12
     37            make $j
    3838    else
    39             make -j 12
     39            make -j $j
    4040    fi
    4141
  • TabularUnified issm/trunk-jpl/externalpackages/libtool/install.sh

    r12189 r12846  
    22
    33#Some cleanup
    4 rm -rf install libtool-2.2.6b src
     4rm -rf install libtool[\w.- ]* src
    55mkdir install
    66
    77#Download from ISSM server
    8 $ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/libtool-2.2.6b.tar.gz' 'libtool-2.2.6b.tar.gz'
     8$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/libtool' 'libtool'
    99
    1010#Untar
    11 tar -zxvf  libtool-2.2.6b.tar.gz
     11tar -zxvf  libtool[\w.-]*.tar.gz
     12rm libtool[\w.-]*.tar.gz
     13
    1214
    1315#Move libtool into src directory
    14 mv libtool-2.2.6b src
     16mv libtool[\w.-]* src
    1517
    1618#Compile libtool
  • TabularUnified issm/trunk-jpl/externalpackages/triangle/configs/android/configure.make

    r12579 r12846  
    11# This makefile configures build process to cross-compile to the android platform.
    2 # The binary tools referenced below are specifically configuered to target armeabi-v7a.
     2# The binary tools referenced below are specifically configured to target armeabi-v7a.
    33# Furthermore, the compilers (which are simply wrappers around GNU GCC) are set to
    4 # produce binaries that are EABI complient.
     4# produce binaries that are EABI compliant.
    55#
    66# Note that the AAPCS standard defines 'EABI' as a moniker used to specify
     
    99#
    1010# http://www.codesourcery.com/gnu_toolchains/arm/arm_gnu_linux_abi.pdf
     11
     12source $ANDROID_DIR/android_aux.sh
     13
    1114CC=${toolchain_path}-gcc
    1215AR=${toolchain_path}-ar
  • TabularUnified issm/trunk-jpl/scripts/DownloadExternalPackage.py

    r12188 r12846  
    22# -*- coding: ISO-8859-1 -*-
    33
    4 import os,sys
     4import os,sys,re
    55import urllib
     6from HTMLParser import HTMLParser
     7from urllib import FancyURLopener
    68
    7 #Check inputs
    8 if(len(sys.argv)!=3): raise NameError('usage: ./DownloadExternalPackage.py URL localfile')
     9# Start class myHTMLParser
     10class MyHTMLParser(HTMLParser):
    911
    10 url=sys.argv[1];
     12    def __init__(self, pattern):
     13        HTMLParser.__init__(self)
     14        self.matcher = re.compile(pattern)
     15        self.targets = []
     16
     17    def handle_starttag(self, tag, attrs):
     18        for i in attrs:
     19            if "href" == i[0] and str(self.matcher.match(i[1])) != "None":
     20                self.targets.append(i[1])
     21# End class myHTMLParser
     22
     23pivot = sys.argv[1].rfind("/")
     24url = (sys.argv[1])[:pivot]
    1125localFile=sys.argv[2]
    1226
    13 #Remove file if it already exists
    14 if os.path.exists(localFile):
    15         print "File "+ localFile +" already exists and will not be downloaded..."
    16         sys.exit()
     27pivot += 1;
     28find = (sys.argv[1])[pivot:];
     29print "Looking for " + find
     30pattern = find + "[\w.-]*(\.tar\.gz|tar\.gz2|tgz|zip|exe)?"
     31parser = MyHTMLParser(pattern)
    1732
    18 #Try to download from url
    19 httpfail=-1
    20 try:
    21         print "Fetching %s" % localFile
    22         urllib.urlretrieve(url,localFile)
    23         httpfail=0
    24 except Exception, e:
    25         httpfail=1
     33urlObject = FancyURLopener()
     34obj = urlObject.open(url)
     35parser.feed(obj.read())
    2636
    27 #Error message in case it failed
    28 if (httpfail):
    29         failureMessage = '''
    30 ===========================================================================
    31 Unable to download package %s from: %s
    32 * If URL specified manually - perhaps there is a typo?
    33 * If your network is disconnected - please reconnect
    34 * Alternatively, you can download the above URL manually
    35 ===========================================================================
    36 ''' % (localFile,url)
    37         raise RuntimeError(failureMessage)
     37if len(parser.targets) > 1:
     38    print "Could not resolve your download due to the number of hits."
     39    print "Refine your search."
     40    for i in parser.targets:
     41        print i
     42
     43elif len(parser.targets) == 1:
     44    url += "/" + parser.targets[0]
     45    if os.path.exists(localFile):
     46        print "File "+ localFile +" already exists and will not be downloaded..."
     47    elif parser.targets[0] == localFile:
     48        urllib.urlretrieve(url, localFile)
     49        print "Found: " + parser.targets[0]
     50    elif parser.matcher.match(localFile) != "None":
     51        urllib.urlretrieve(url,parser.targets[0]);
     52        print "Found: " + parser.targets[0]
     53    else:
     54        urllib.urlretrieve(url, parser.targets[0]);
     55        print "WARNING: the file found \'" + parser.targets[0] + "\' does not match \'" + localFile + "\'"
     56        print "Ensure the downloaded version is suitable."
     57
     58else:
     59    print "No matches found!"
     60
     61obj.close()
Note: See TracChangeset for help on using the changeset viewer.