diff options
author | Matteo Bertozzi <theo.bertozzi@gmail.com> | 2011-08-24 19:50:13 +0200 |
---|---|---|
committer | Matteo Bertozzi <theo.bertozzi@gmail.com> | 2011-08-24 19:50:13 +0200 |
commit | 486113ca8aed244ad5468f0e0da932ffcc243e66 (patch) | |
tree | fc3044691c0169d69226e97f4af7e40327110f28 /buildlibxml.py | |
parent | 443e5b307b1ceca0790e42f527db4c570e8ed7a8 (diff) | |
download | python-lxml-486113ca8aed244ad5468f0e0da932ffcc243e66.tar.gz |
patch that copies headers only if --static is
specified, also works with python 2.3.
Tested with:
LINUX: python setup.py build --static --static-deps install
WINDOWS: python setup.py bdist_wininst --static
Diffstat (limited to 'buildlibxml.py')
-rw-r--r-- | buildlibxml.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/buildlibxml.py b/buildlibxml.py index bfcf3e41..acef12f3 100644 --- a/buildlibxml.py +++ b/buildlibxml.py @@ -115,7 +115,7 @@ def download_libiconv(dest_dir, version=None): return download_library(dest_dir, LIBICONV_LOCATION, 'libiconv', version_re, filename, version=version) -def download_library(dest_dir, location, name, version_re, filename, +def download_library(dest_dir, location, name, version_re, filename, version=None): if version is None: try: @@ -227,11 +227,23 @@ def unpack_tarball(tar_filename, dest): return os.path.join(dest, base_dir) def call_subprocess(cmd, **kw): - import subprocess + try: + from subprocess import proc_call + except ImportError: + # no subprocess for Python 2.3 + def proc_call(cmd, **kwargs): + cwd = kwargs.get('cwd', '.') + old_cwd = os.getcwd() + try: + os.chdir(cwd) + return os.system(' '.join(cmd)) + finally: + os.chdir(old_cwd) + cwd = kw.get('cwd', '.') cmd_desc = ' '.join(cmd) log.info('Running "%s" in %s' % (cmd_desc, cwd)) - returncode = subprocess.call(cmd, **kw) + returncode = proc_call(cmd, **kw) if returncode: raise Exception('Command "%s" returned code %s' % (cmd_desc, returncode)) |