From 707993f8c9d2384222c5157655fe0a905a6678d7 Mon Sep 17 00:00:00 2001 From: Ted Summer Date: Thu, 9 Apr 2020 15:19:37 -0600 Subject: [PATCH] feat(bricr): translate bricr to 2.0 chore(bricr): remove schema file --- .gitignore | 2 + {v2.0pr1-to-v2.0 => BRICR-to-v2.0}/.gitkeep | 0 BRICR-to-v2.0/README.md | 68 ++++++ BRICR-to-v2.0/main.py | 256 ++++++++++++++++++++ BRICR-to-v2.0/parse_errors.py | 92 +++++++ BRICR-to-v2.0/requirements.txt | 2 + BRICR-to-v2.0/utils.py | 104 ++++++++ BRICR-to-v2.0/validate.sh | 16 ++ 8 files changed, 540 insertions(+) create mode 100644 .gitignore rename {v2.0pr1-to-v2.0 => BRICR-to-v2.0}/.gitkeep (100%) create mode 100644 BRICR-to-v2.0/README.md create mode 100644 BRICR-to-v2.0/main.py create mode 100644 BRICR-to-v2.0/parse_errors.py create mode 100644 BRICR-to-v2.0/requirements.txt create mode 100644 BRICR-to-v2.0/utils.py create mode 100755 BRICR-to-v2.0/validate.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..96bb5cf --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__ +**/*.xsd \ No newline at end of file diff --git a/v2.0pr1-to-v2.0/.gitkeep b/BRICR-to-v2.0/.gitkeep similarity index 100% rename from v2.0pr1-to-v2.0/.gitkeep rename to BRICR-to-v2.0/.gitkeep diff --git a/BRICR-to-v2.0/README.md b/BRICR-to-v2.0/README.md new file mode 100644 index 0000000..6a77ff2 --- /dev/null +++ b/BRICR-to-v2.0/README.md @@ -0,0 +1,68 @@ +## Setup +``` +python3 -m pip install -r requirements.txt +``` +For validation, might need to install [xmllint](https://linux.die.net/man/1/xmllint) if not on a Mac or Ubuntu machine. +Download the v2.0 schema locally +```bash +curl -o schema_2_0.xsd https://raw.githubusercontent.com/BuildingSync/schema/v2.0/BuildingSync.xsd +``` +## Steps +Overview: +- generate validation errors for original files +- using those errors, fix the files +- validate the fixed files +- replace the original files with the fixed files + +First step is to generate validation errors for the files. +```bash +# stdin: line separated paths to files to validate +# arg1: label for this validation run - e.g. initial_validation +# arg2: path to the local v2.0 xsd +# output: +# the names of files that failed validation are put in failed_