diff options
author | clutton <clutton@zoho.com> | 2016-04-14 22:33:21 +0300 |
---|---|---|
committer | clutton <clutton@zoho.com> | 2016-04-14 22:33:21 +0300 |
commit | 7dfb29db81c7a07bfaefd148258c6a897e8bac1b (patch) | |
tree | fe4ea88adc063545bd34b0dbd124fd1bc769b44c /include_server/compress_files.py | |
parent | 50e5b666d85c92a963ed6c1d4150683e87b8b9a5 (diff) | |
download | distcc-git-python3.tar.gz |
include_server python(3) readypython3
Diffstat (limited to 'include_server/compress_files.py')
-rwxr-xr-x | include_server/compress_files.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include_server/compress_files.py b/include_server/compress_files.py index 20512fd..880551e 100755 --- a/include_server/compress_files.py +++ b/include_server/compress_files.py @@ -1,4 +1,4 @@ -#! /usr/bin/python2.4 +#! /usr/bin/env python3 # Copyright 2007 Google Inc. # @@ -16,7 +16,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. - + """Compress files in an include closure.""" import os @@ -67,10 +67,10 @@ class CompressFiles(object): if len(include_closure[realpath_idx]) > 0: # Designate by suffix '.abs' that this file is to become known by an # absolute filepath through a #line directive. - new_filepath = "%s%s.lzo.abs" % (client_root_keeper.client_root, + new_filepath = "%s%s.lzo.abs" % (client_root_keeper.client_root, realpath) else: - new_filepath = "%s%s.lzo" % (client_root_keeper.client_root, + new_filepath = "%s%s.lzo" % (client_root_keeper.client_root, realpath) files.append(new_filepath) if not new_filepath in self.files_compressed: @@ -80,7 +80,7 @@ class CompressFiles(object): if not os.path.isdir(dirname): my_root = client_root_keeper.client_root self.mirror_path.DoPath(realpath, currdir_idx, my_root) - except (IOError, OSError), why: + except (IOError, OSError) as why: # Kill include server sys.exit("Could not make directory '%s': %s" % (dirname, why)) if new_filepath.endswith('.abs'): @@ -99,17 +99,17 @@ class CompressFiles(object): prefix = "" try: real_file_fd = open(realpath, "r") - except (IOError, OSError), why: + except (IOError, OSError) as why: sys.exit("Could not open '%s' for reading: %s" % (realpath, why)) try: new_filepath_fd = open(new_filepath, "wb") - except (IOError, OSError), why: + except (IOError, OSError) as why: sys.exit("Could not open '%s' for writing: %s" % (new_filepath, why)) try: new_filepath_fd.write( distcc_pump_c_extensions.CompressLzo1xAlloc( prefix + real_file_fd.read())) - except (IOError, OSError), why: + except (IOError, OSError) as why: sys.exit("Could not write to '%s': %s" % (new_filepath, why)) new_filepath_fd.close() real_file_fd.close() |