From 8daf596882ce867a1c8c00de6581aa91267032de Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sun, 10 May 2009 10:56:57 +0100 Subject: [PATCH] Don't require Python 2.5 for the build slave It's often useful to build on older machines. --- compile.py | 4 ++-- support.py | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/compile.py b/compile.py index 401f5ee..182f854 100644 --- a/compile.py +++ b/compile.py @@ -126,8 +126,8 @@ def build_slave(src_feed, archive_file, archive_dir_public_url, target_feed): finally: stream.close() - subprocess.check_call(['0launch', COMPILE, 'build'], cwd = tmpdir) - subprocess.check_call(['0launch', COMPILE, 'publish', '--target-feed', target_feed], cwd = tmpdir) + support.check_call(['0launch', COMPILE, 'build'], cwd = tmpdir) + support.check_call(['0launch', COMPILE, 'publish', '--target-feed', target_feed], cwd = tmpdir) # TODO: run unit-tests diff --git a/support.py b/support.py index 0a86a20..6537188 100644 --- a/support.py +++ b/support.py @@ -1,6 +1,7 @@ # Copyright (C) 2007, Thomas Leonard # See the README file for details, or visit http://0install.net. +import copy import os, subprocess, shutil, tarfile import urlparse, ftplib, httplib from zeroinstall import SafeException @@ -196,7 +197,12 @@ def get_size(url): def unpack_tarball(archive_file): tar = tarfile.open(archive_file, 'r:bz2') members = [m for m in tar.getmembers() if m.name != 'pax_global_header'] - tar.extractall('.', members = members) + #tar.extractall('.', members = members) # Python >= 2.5 only + for tarinfo in members: + tarinfo = copy.copy(tarinfo) + tarinfo.mode |= 0600 + tarinfo.mode &= 0755 + tar.extract(tarinfo, '.') def load_feed(path): stream = open(path) @@ -206,7 +212,8 @@ def load_feed(path): stream.close() def get_archive_basename(impl): - return os.path.basename(urlparse.urlparse(impl.download_sources[0].url).path) + # "2" means "path" (for Python 2.4) + return os.path.basename(urlparse.urlparse(impl.download_sources[0].url)[2]) def relative_path(ancestor, dst): stem = os.path.abspath(os.path.dirname(ancestor)) -- 2.11.4.GIT