Skip to content

Commit

Permalink
Merge pull request #47 from nusbaume/stdname_meta_checker
Browse files Browse the repository at this point in the history
Add CCPP metadata file standard name checking script
  • Loading branch information
nusbaume authored Oct 2, 2023
2 parents 7b0fa70 + 38a2224 commit f0b76c8
Show file tree
Hide file tree
Showing 6 changed files with 397 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pull_request_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
sudo apt-get -y install libxml2-utils
- name: Check for duplicate standard names
run: python3 check_xml_unique.py standard_names.xml
run: tools/check_xml_unique.py standard_names.xml

check-rerendered-markdown:
runs-on: ubuntu-latest
Expand All @@ -41,5 +41,5 @@ jobs:
# If this fails you have likely forgotten to rerun the write script
# after adding a new name, or updating its description.
checksum=$(sha256sum Metadata-standard-names.md)
python3 write_standard_name_table.py standard_names.xml
tools/write_standard_name_table.py standard_names.xml
test "$checksum" = "$(sha256sum Metadata-standard-names.md)"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A Markdown file describing the standard names

To regenerate the standard name Markdown file, run:
```
python write_standard_name_table.py standard_names.xml
tools/write_standard_name_table.py standard_names.xml
```

Then, commit the new Metadata-standard-names.md file and push to GitHub.
17 changes: 15 additions & 2 deletions check_xml_unique.py → tools/check_xml_unique.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,21 @@
import sys
import os.path
import xml.etree.ElementTree as ET
from xml_tools import find_schema_file, find_schema_version, validate_xml_file, read_xml_file
import copy

################################################
#Add CCPP framework (lib) modules to python path
################################################

_CURR_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(_CURR_DIR, "lib"))

#######################################
#Import needed framework python modules
#######################################

from xml_tools import find_schema_file, find_schema_version, validate_xml_file, read_xml_file

###############################################################################
def parse_command_line(args, description):
###############################################################################
Expand Down Expand Up @@ -40,7 +52,8 @@ def main_func():
version = find_schema_version(root)
schema_name = os.path.basename(stdname_file)[0:-4]
schema_root = os.path.dirname(stdname_file)
schema_file = find_schema_file(schema_name, version)
schema_path = os.path.join(schema_root,schema_name)
schema_file = find_schema_file(schema_path, version)
if schema_file:
try:
validate_xml_file(stdname_file, schema_name, version, None,
Expand Down
File renamed without changes.
Loading

0 comments on commit f0b76c8

Please sign in to comment.