aboutsummaryrefslogtreecommitdiff
path: root/scripts/spec.py
diff options
context:
space:
mode:
authorMark Lobodzinski <mark@lunarg.com>2018-03-01 10:25:58 -0700
committerMark Lobodzinski <mark@lunarg.com>2018-03-01 13:52:03 -0700
commitf3e20b3bfbcc2899dcaa6b9f58d3048ae784e112 (patch)
tree65653d53ba7ad3ffc4fe15cb1ac2c08917095ec8 /scripts/spec.py
parent1227045c106086de4a149c21461ae899163eb717 (diff)
downloadusermoji-f3e20b3bfbcc2899dcaa6b9f58d3048ae784e112.tar.xz
scripts: Mod spec.py to use local validusage.json
This script by default used the latest version of validusage.json from the web. Changed to use the local copy checked into the repo. Used the json-file option to fetch from a non-default location, removed the -json arg and the URL option entirely. Change-Id: Id088b08c8e66a3cdfca2b9e771797bffe941e5d3
Diffstat (limited to 'scripts/spec.py')
-rw-r--r--scripts/spec.py18
1 files changed, 5 insertions, 13 deletions
diff --git a/scripts/spec.py b/scripts/spec.py
index 51624483..b69b9b87 100644
--- a/scripts/spec.py
+++ b/scripts/spec.py
@@ -28,11 +28,9 @@ import re
out_filename = "../layers/vk_validation_error_messages.h" # can override w/ '-out <filename>' option
db_filename = "../layers/vk_validation_error_database.txt" # can override w/ '-gendb <filename>' option
-json_filename = None # con pass in w/ '-json <filename> option
+json_filename = "../scripts/validusage.json" # can override w/ '-json-file <filename> option
gen_db = False # set to True when '-gendb <filename>' option provided
json_compare = False # compare existing DB to json file input
-json_url = "https://www.khronos.org/registry/vulkan/specs/1.0-extensions/validation/validusage.json"
-read_json = False
# This is the root spec link that is used in error messages to point users to spec sections
#old_spec_url = "https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html"
spec_url = "https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html"
@@ -44,7 +42,7 @@ error_msg_prefix = "The spec valid usage text states "
validation_error_enum_name = "VALIDATION_ERROR_"
def printHelp():
- print ("Usage: python spec.py [-out <headerfile.h>] [-gendb <databasefile.txt>] [-update] [-json <json_file>] [-help]")
+ print ("Usage: python spec.py [-out <headerfile.h>] [-gendb <databasefile.txt>] [-update] [-json-file <json_file>] [-help]")
print ("\n Default script behavior is to parse the specfile and generate a header of unique error enums and corresponding error messages based on the specfile.\n")
print (" Default specfile is from online at %s" % (spec_url))
print (" Default headerfile is %s" % (out_filename))
@@ -53,8 +51,7 @@ def printHelp():
print (" the list of enums and their error messages.")
print ("\nIf '-update' option is specified this triggers the master flow to automate updating header and database files using default db file as baseline")
print (" and online spec file as the latest. The default header and database files will be updated in-place for review and commit to the git repo.")
- print ("\nIf '-json' option is used trigger the script to load in data from a json file.")
- print ("\nIf '-json-file' option is it will point to a local json file, else '%s' is used from the web." % (json_url))
+ print ("\nIf '-json-file' option is specified, it will override the default json file location")
def get8digithex(dec_num):
"""Convert a decimal # into an 8-digit hex"""
@@ -324,8 +321,6 @@ if __name__ == "__main__":
if (arg == '-json-file'):
json_filename = sys.argv[i]
i = i + 1
- elif (arg == '-json'):
- read_json = True
elif (arg == '-json-compare'):
json_compare = True
elif (arg == '-out'):
@@ -338,17 +333,14 @@ if __name__ == "__main__":
db_filename = sys.argv[i]
i = i + 1
elif (arg == '-update'):
- read_json = True
json_compare = True
gen_db = True
elif (arg in ['-help', '-h']):
printHelp()
sys.exit()
spec = Specification()
- if read_json:
- spec.readJSON()
- spec.parseJSON()
- #sys.exit()
+ spec.readJSON()
+ spec.parseJSON()
if (json_compare):
# Read in current spec info from db file
(orig_err_msg_dict) = spec.readDB(db_filename)