Source
parser.add_argument("--installationtype", help="Type of installation. Valid values: dev, package", default="dev")
import re
import sys
import os
import argparse
import urllib
import urllib2
from HTMLParser import HTMLParser
from subprocess import check_output
import platform
# Supported operating system versions
osVersions = ["el6", "el7", "osx1011", "osx1012"]
script_dir = os.path.dirname(os.path.realpath(__file__))
class MyHTMLParser(HTMLParser):
links = []
def handle_starttag(self, tag, attrs):
# Only parse the 'anchor' tag.
if tag == "a":
# Check the list of defined attributes.
for name, value in attrs:
# If href is defined, print it.
if name == "href":
print name, "=", value
if value.lower().startswith("carta") and ".md5" not in value:
self.links.append(value)
def get_links(self):
return self.links
# sampleUrl=https://svn.cv.nrao.edu/casa/distro/osx/cartadev/master/
base_url = "https://casa.nrao.edu/download/distro/"
url_tail = "/cartarel/"
package_name = ""
def splitext(path):
for ext in ['.tar.gz', '.tar.bz2']:
if path.endswith(ext):
return path[:-len(ext)], path[-len(ext):]
return os.path.splitext(path)
def resolve_os():
print "Resolving OS"
detected_os = "linux"
if "el7" in platform.uname()[2]:
detected_os = 'el7'
if "el6" in platform.uname()[2]:
detected_os = 'el6'
if "Darwin Kernel Version 15" in platform.uname()[3]:
# os = 'osx1011'
detected_os = 'osx'
if "Darwin Kernel Version 16" in platform.uname()[3]:
# os= 'osx1012'
detected_os = 'osx'
if "Darwin Kernel Version 17" in platform.uname()[3]:
# os= 'osx1012'
detected_os = 'osx'
print "Found " + detected_os