From 863270777544016224e24086304a7121224fa9a0 Mon Sep 17 00:00:00 2001 From: zslade Date: Fri, 8 Sep 2023 16:53:39 +0100 Subject: [PATCH 1/3] Stopped installing again if already in docs-vene --- scripts/make_docs_locally.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/scripts/make_docs_locally.sh b/scripts/make_docs_locally.sh index 442ec98117..f582df1abc 100755 --- a/scripts/make_docs_locally.sh +++ b/scripts/make_docs_locally.sh @@ -4,11 +4,18 @@ # python scripts/json_schema_to_md_doc.py # python scripts/generate_dialect_comparison_docs.py -deactivate -python3 -m venv docs-venv -source docs-venv/bin/activate -pip install --upgrade pip -pip install -r scripts/docs-requirements.txt +if [[ "$VIRTUAL_ENV" != "$cwd/docs-venv" ]]; then + if [ -n "$VIRTUAL_ENV" ]; then + deactivate + else + : + fi + python3 -m venv docs-venv + source docs-venv/bin/activate + pip install --upgrade pip + pip install -r scripts/docs-requirements.txt +fi + # if you haven't run generate_dialect_comparison_docs.py, then install the splink dependencies and run if [[ ! -f "docs/includes/generated_files/comparison_level_library_dialect_table.md" ]] then From 42674e2585c62aba28240ef712316f779e8124ac Mon Sep 17 00:00:00 2001 From: Tom Hepworth Date: Mon, 11 Sep 2023 12:34:07 +0100 Subject: [PATCH 2/3] build docs table from latest splink build --- scripts/make_docs_locally.sh | 6 +++--- scripts/test_poetry_build.sh | 24 +++++++++++++++++------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/scripts/make_docs_locally.sh b/scripts/make_docs_locally.sh index f582df1abc..cac96068b3 100755 --- a/scripts/make_docs_locally.sh +++ b/scripts/make_docs_locally.sh @@ -7,7 +7,7 @@ if [[ "$VIRTUAL_ENV" != "$cwd/docs-venv" ]]; then if [ -n "$VIRTUAL_ENV" ]; then deactivate - else + else : fi python3 -m venv docs-venv @@ -19,8 +19,8 @@ fi # if you haven't run generate_dialect_comparison_docs.py, then install the splink dependencies and run if [[ ! -f "docs/includes/generated_files/comparison_level_library_dialect_table.md" ]] then - pip install poetry - poetry install + # add the latest Splink build to the deployment + source scripts/test_poetry_build.sh --current_venv python3 scripts/generate_dialect_comparison_docs.py python3 scripts/generate_dataset_docs.py fi diff --git a/scripts/test_poetry_build.sh b/scripts/test_poetry_build.sh index ff2a29bde9..77ba9bc11b 100644 --- a/scripts/test_poetry_build.sh +++ b/scripts/test_poetry_build.sh @@ -1,13 +1,23 @@ #!/bin/bash -deactivate -# Delete the dist folder if it exists -rm -rf dist/ -rm -rf venv +# If the user requests that the current virtual +# environment be used - "--current_venv" - +# install poetry (if not already installed) and the latest Splink build. +# Otherwise, deactivate and create a new venv. +if [ "$1" == "--current_venv" ]; then + pip3 install poetry +else + deactivate + # Delete the dist folder if it exists + rm -rf dist/ + rm -rf venv -# Setup python and build the package -python3 -m venv venv -source venv/bin/activate + # Setup python and build the package + python3 -m venv venv + source venv/bin/activate +fi + +# Create the wheel for the poetry build poetry build --format=wheel --verbose # Find the `.whl` file From 084aa8d9838e55bec0f7ba360d24814a7c6353bb Mon Sep 17 00:00:00 2001 From: Tom Hepworth Date: Mon, 25 Sep 2023 12:53:33 +0100 Subject: [PATCH 3/3] resolve issue w/ flag --- scripts/test_poetry_build.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/test_poetry_build.sh b/scripts/test_poetry_build.sh index 77ba9bc11b..78617d47aa 100644 --- a/scripts/test_poetry_build.sh +++ b/scripts/test_poetry_build.sh @@ -4,13 +4,16 @@ # environment be used - "--current_venv" - # install poetry (if not already installed) and the latest Splink build. # Otherwise, deactivate and create a new venv. -if [ "$1" == "--current_venv" ]; then +if [ "$1" = "--current_venv" ]; then + # Installing poetry in the current virtual environment pip3 install poetry else - deactivate + # Deactivate the current virtual environment if it is active + if command -v deactivate > /dev/null 2>&1; then + deactivate + fi # Delete the dist folder if it exists - rm -rf dist/ - rm -rf venv + rm -rf dist/ venv/ # Setup python and build the package python3 -m venv venv