summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorC Nelson <cnelsonsic@gmail.com>2012-04-06 13:12:30 -0500
committerC Nelson <cnelsonsic@gmail.com>2012-04-06 13:12:30 -0500
commitbd06a22fb874dcc2a51255670656afec6f5e21ea (patch)
tree9e6ee2aa126648ebf020367505e3a3fd82bc3aff
parent1d17d3e8104606da398becc8430d02aba5eea06b (diff)
Making generate_diff_insert python2.7 compatible.
-rw-r--r--extras/crystal.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/extras/crystal.py b/extras/crystal.py
index 211c13207..316fdde36 100644
--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -5836,13 +5836,16 @@ def generate_diff_insert(line_number, newline, debug=False):
newfile_fh.close()
try:
+ from subprocess import CalledProcessError
+ except ImportError:
+ CalledProcessError = None
+
+ try:
diffcontent = subprocess.check_output("diff -u ../main.asm " + newfile_filename, shell=True)
- except AttributeError, exc:
+ except (AttributeError, CalledProcessError):
p = subprocess.Popen(["diff", "-u", "../main.asm", newfile_filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
diffcontent = out
- except Exception, exc:
- raise exc
os.system("rm " + original_filename)
os.system("rm " + newfile_filename)