def download(self): '''Download missing or update pre-existing project files. As a side effect the program will be in the projects directory that contains the downloaded project''' log.info(self.name +' download') import fs, ConfigParser projdir = fs.projects() fs.goto(projdir, True) from get import get try: tag = self.tag() except ConfigParser.NoOptionError: tag = None #print 'url="%s" name="%s" tag="%s"'%(self.url(), self.name, tag) get(self.url(), self.name, True, tag=tag) tarfile = os.path.basename(self.url()) if '.tgz' in tarfile or '.tar' in tarfile: untar(tarfile) dot = tarfile.find('.') dirname = tarfile[:dot] import shutil shutil.move(dirname, self.name) pass fs.goback return
def extractInstallScripts( installDir ): cwd = os.getcwd() os.chdir(installDir) untar("install-scripts.tar.gz", path=installDir) return os.path.isdir( os.path.join( installDir,"install-scripts" ))
def download(untar_dir): valgrind_release_url = VALGRIND_URL_FORMAT.replace('VER', VALGRIND_VER) util.download(valgrind_release_url) valgrind_tarball = 'valgrind-VER.tar.bz2'.replace('VER', VALGRIND_VER) util.untar(valgrind_tarball) shutil.move('valgrind-VER'.replace('VER', VALGRIND_VER), untar_dir)
def extract_binary(binary): if (os.path.lexists(ARGS.install_dir +"/"+binary+ ".tar.gz")): if (windows): cygwin_untar(ARGS.install_dir +"/"+binary+ ".tar.gz",binary+ ".tar.gz") else: untar(binary+ ".tar.gz") else: print_console( "The required file "+binary+ ".tar.gz was not found")
def unpack(): 'Unpack the previously downloaded tarfile' log.info('unpacking cmt source') target = srcdir() if os.path.exists(target): log.info('CMT appears to already be unpacked in %s'%(target)) return target fs.goto(fs.external(),True) untar(tgz()) return target
def unpack(): "Unpack the previously downloaded tarfile" log.info("unpacking git source") target = srcdir() if os.path.exists(target): log.info("git appears to already be unpacked in %s" % (target)) return target fs.goto(fs.external(), True) untar(tgz()) return target
def prepare_gold(version): curdir = os.getcwd() binutils_tarball = binutils_tarball_format.replace('VERSION', version) binutils_url = binutils_url_format.replace('TARBALL', binutils_tarball) util.download(binutils_url) util.untar(binutils_tarball) os.chdir('binutils-VERSION'.replace('VERSION', version)) util.configure( '--prefix=%s --enable-gold --enable-plugins --disable-werror' % curdir) util.make('-j4') util.make('-j4 all-gold') util.make('install') os.chdir(curdir)
def detect_platform(temp_dir): fetcher = Fetcher() os.chdir(temp_dir) path= fetcher.getResource("resources/probes.tar.gz", temp_dir+"/probes.tar.gz") print_console(PROGRAM+"Extracted probes to:"+path) untar(path,temp_dir) detector = PlatformDetector(temp_dir+"/probes/") platform=detector.detect_platform() print_console(PROGRAM+"Detected platform as: "+platform) ARGS.platform=platform return platform
def extract_tarballs(windows=False): def extract_binary(binary): if (os.path.lexists(ARGS.install_dir +"/"+binary+ ".tar.gz")): if (windows): cygwin_untar(ARGS.install_dir +"/"+binary+ ".tar.gz",binary+ ".tar.gz") else: untar(binary+ ".tar.gz") else: print_console( "The required file "+binary+ ".tar.gz was not found") print_console( "Decompressing framework...") os.chdir(ARGS.install_dir) if (os.path.lexists(ARGS.install_dir + "/framework.tar.gz")): if (windows and not ARGS.isGitDev): cygwin_untar(ARGS.install_dir + "/framework.tar.gz","framework.tar.gz") elif(not ARGS.isGitDev): untar("framework.tar.gz") elif (ARGS.isGitDev): if (windows): cygwin_untar(ARGS.install_dir + "/framework.tar.gz","framework.tar.gz",noroot=True) else: excludelist=list() if (ARGS.is_update): exclude.append("local") untar("framework.tar.gz",path=".",noroot=True,exclude=excludelist) #print_console("Restoring permission/time data.") #restoreMetaData(ARGS.install_dir) #print_console("Metadata restored.") else: print_console( "The required file framework.tar.gz was not found") return print_console( "Decompressing binaries...") if (not ARGS.multi_bins): extract_binary(ARGS.platform) else: for each in ARGS.platforms: extract_binary(each)
def __init__(self): url = \ 'http://groups.inf.ed.ac.uk/calvin/ethz_pascal_stickmen/'\ 'downloads/ETHZ_PASCAL_Stickmen_v1.11.tgz' data_filename = os.path.basename(url) self.data_filepath = os.path.join(dataset_root, data_filename) data_directory = os.path.join(dataset_root, 'ETHZ_PASCAL_Stickmen_v1.11') self.loaded = False if not(os.path.exists(self.data_filepath)): download(url, self.data_filepath) if not(os.path.exists(data_directory)): untar(self.data_filepath, dataset_root) shutil.move(os.path.join(data_directory, 'images'), os.path.join(dataset_root, 'images')) shutil.move(os.path.join(data_directory, 'data'), os.path.join(dataset_root, 'annotations'))