mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-01-23 09:16:20 -08:00
Making generate_diff_insert python2.7 compatible.
This commit is contained in:
parent
1d17d3e810
commit
bd06a22fb8
@ -5835,14 +5835,17 @@ def generate_diff_insert(line_number, newline, debug=False):
|
|||||||
newfile_fh.write(newfile)
|
newfile_fh.write(newfile)
|
||||||
newfile_fh.close()
|
newfile_fh.close()
|
||||||
|
|
||||||
|
try:
|
||||||
|
from subprocess import CalledProcessError
|
||||||
|
except ImportError:
|
||||||
|
CalledProcessError = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
diffcontent = subprocess.check_output("diff -u ../main.asm " + newfile_filename, shell=True)
|
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)
|
p = subprocess.Popen(["diff", "-u", "../main.asm", newfile_filename], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
out, err = p.communicate()
|
out, err = p.communicate()
|
||||||
diffcontent = out
|
diffcontent = out
|
||||||
except Exception, exc:
|
|
||||||
raise exc
|
|
||||||
|
|
||||||
os.system("rm " + original_filename)
|
os.system("rm " + original_filename)
|
||||||
os.system("rm " + newfile_filename)
|
os.system("rm " + newfile_filename)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user