From 38b1937363e99be95cb046361a4a52df970dc4ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20Sandstr=C3=B6m?= Date: Fri, 13 Sep 2024 14:06:03 +0200 Subject: [PATCH] Add files --- pythonVenv.sh | 19 +++++++++++++++++++ readme.md | 24 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100755 pythonVenv.sh create mode 100644 readme.md diff --git a/pythonVenv.sh b/pythonVenv.sh new file mode 100755 index 0000000..8a91ceb --- /dev/null +++ b/pythonVenv.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +while getopts d: arg +do + case "${arg}" in + d) TMP_DIR=${OPTARG};; + esac +done + +ENV_DIR="${TMP_DIR=/tmp}"/.venv + +if [ -d "${ENV_DIR}" ]; then + . "${ENV_DIR}"/bin/activate +else + python3 -m venv "${ENV_DIR}" + . "${ENV_DIR}"/bin/activate + pip3 install wheel pyyaml jinja2-cli yamllint Cerberus +fi diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..58acae8 --- /dev/null +++ b/readme.md @@ -0,0 +1,24 @@ +# venv for ecmccfg +This dir contains a python venv that is needed for ecmccfg when using yaml files (motion or plc cfgs). + +## Generate the venv + +Use pythonVenv.sh to generate an ecmc venv in current dir (the script is copied from ecmccfg/scripts/jinja2/): +``` +bash pythonVenv.sh -d . +``` + +The env should then be copied to /ioc/NeedfulThings/ecmc_python_venv/: + +``` +[sls-lc8 ioc]$ ls -la /ioc/NeedfulThings/ecmc_python_venv/.venv +total 32 +drwxrwsr-x. 7 sandst_a unx-sls_ioc 4096 May 3 16:07 . +drwxrwsr-x. 3 sandst_a unx-sls_ioc 4096 May 3 17:47 .. +drwxrwxr-x. 2 sandst_a unx-sls_ioc 4096 May 3 16:06 bin +drwxrwxr-x. 2 sandst_a unx-sls_ioc 4096 May 3 16:07 include +drwxrwsr-x. 3 sandst_a unx-sls_ioc 4096 May 3 16:06 lib +drwxrwxr-x. 3 sandst_a unx-sls_ioc 4096 May 3 16:06 lib64 +-rw-rw-r--. 1 sandst_a unx-sls_ioc 69 May 3 16:07 pyvenv.cfg +drwxrwxr-x. 3 sandst_a unx-sls_ioc 4096 May 3 16:06 share +```