mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-26 21:30:07 +00:00
Imporve compatibility with Python3.
* Use print_function from __future__ to tackle the print syntax change. * In Python3 str and bytes are no longer the same thing. Need proper decode.
This commit is contained in:
parent
680f9b7ef1
commit
703b0f7ab4
@ -23,6 +23,8 @@
|
||||
# directory's "git describe" output enclosed in double quotes and appropriately
|
||||
# escaped.
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import datetime
|
||||
import os.path
|
||||
import subprocess
|
||||
@ -64,10 +66,11 @@ def describe(dir):
|
||||
|
||||
def main():
|
||||
if len(sys.argv) != 2:
|
||||
print 'usage: {0} <spirv-tools_dir>'.format(sys.argv[0])
|
||||
print('usage: {0} <spirv-tools_dir>'.format(sys.argv[0]))
|
||||
sys.exit(1)
|
||||
|
||||
new_content = ('"spirv-tools ' + describe(sys.argv[1]).replace('"', '\\"') + '\\n"\n')
|
||||
new_content = '"spirv-tools {}\\n"\n'.format(
|
||||
describe(sys.argv[1]).decode('ascii').replace('"', '\\"'))
|
||||
if os.path.isfile(OUTFILE) and new_content == open(OUTFILE, 'r').read():
|
||||
sys.exit(0)
|
||||
open(OUTFILE, 'w').write(new_content)
|
||||
|
Loading…
Reference in New Issue
Block a user