diff --git a/gen/generate-bindings b/gen/generate-bindings index b963c55..bc7041e 100755 --- a/gen/generate-bindings +++ b/gen/generate-bindings @@ -14,12 +14,22 @@ echo "# Import all versions" > __init__.py for v in $SPDX_VERSIONS; do MODNAME="v$(echo "$v" | sed 's/[^a-zA-Z0-9_]/_/g')" - shacl2code generate --input https://spdx.org/rdf/$v/spdx-model.ttl \ - --input https://spdx.org/rdf/$v/spdx-json-serialize-annotations.ttl \ - --context https://spdx.org/rdf/$v/spdx-context.jsonld \ - --license Apache-2.0 \ - python \ - -o "$MODNAME.py" + if [ -n "${SHACL2CODE_SPDX_DIR}" ] && [ -d "${SHACL2CODE_SPDX_DIR}/$v" ] + then + shacl2code generate --input "file://${SHACL2CODE_SPDX_DIR}/$v/spdx-model.ttl" \ + --input "file://${SHACL2CODE_SPDX_DIR}/$v/spdx-json-serialize-annotations.ttl" \ + --context-url "file://${SHACL2CODE_SPDX_DIR}/$v/spdx-context.jsonld" https://spdx.org/rdf/$v/spdx-context.jsonld \ + --license Apache-2.0 \ + python \ + -o "$MODNAME.py" + else + shacl2code generate --input https://spdx.org/rdf/$v/spdx-model.ttl \ + --input https://spdx.org/rdf/$v/spdx-json-serialize-annotations.ttl \ + --context https://spdx.org/rdf/$v/spdx-context.jsonld \ + --license Apache-2.0 \ + python \ + -o "$MODNAME.py" + fi echo "from . import $MODNAME" >> __init__.py done