mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07: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.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)
|
||||
|
Loading…
Reference in New Issue
Block a user