Skip to content

Commit

Permalink
scripts: Improve error importing Reg
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-lunarg committed Sep 12, 2024
1 parent ff33a4e commit 6a0cc0a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/generated_code.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ values when the Vulkan Headers or SPIR-V Grammer is updated.
- [Adding and Editing code generation](#adding-and-editing-code-generation)
- [How it works](#how-it-works)

# Dependency

`pyparsing` is required so if no installed, you will need to call `pip install pyparsing`

# How to generate the code

- Linux:
Expand Down
8 changes: 7 additions & 1 deletion scripts/generate_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ def RunGenerators(api: str, registry: str, grammar: str, directory: str, styleFi
scripts_directory_path = os.path.dirname(os.path.abspath(__file__))
registry_headers_path = os.path.join(scripts_directory_path, scripts)
sys.path.insert(0, registry_headers_path)
from reg import Registry
try:
from reg import Registry
except:
print("ModuleNotFoundError: No module named 'reg'") # normal python error message
print(f'{registry_headers_path} is not pointing to the Vulkan-Headers registry directory.')
print("Inside Vulkan-Headers there is a registry/reg.py file that is used.")
sys.exit(1) # Return without call stack so easy to spot error

from generators.base_generator import BaseGeneratorOptions
from generators.thread_safety_generator import ThreadSafetyOutputGenerator
Expand Down
1 change: 1 addition & 0 deletions scripts/generators/extension_helper_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from generators.base_generator import BaseGenerator
from generators.generator_utils import PlatformGuardHelper

# Need pyparsing because the Vulkan-Headers use it in dependencyBNF
from pyparsing import ParseResults
# From the Vulkan-Headers
from parse_dependency import dependencyBNF
Expand Down

0 comments on commit 6a0cc0a

Please sign in to comment.