diff --git a/local-app/python-tools/build-ansible-distribution/create-ansible.sh b/local-app/python-tools/build-ansible-distribution/create-ansible.sh index bf0a1ede..d9f92a9b 100755 --- a/local-app/python-tools/build-ansible-distribution/create-ansible.sh +++ b/local-app/python-tools/build-ansible-distribution/create-ansible.sh @@ -1,7 +1,7 @@ #!/bin/bash THIS=$(basename $0 .sh) -VERSION="1.0.6" +VERSION="1.0.7" # --- Configuration --- APP_DIR="${1:-/apps/ansible}" @@ -34,6 +34,7 @@ then umask $UMASK fi cd "$APP_DIR" +chmod 755 "$APP_DIR" # chown $OWNER:$GROUP "$APP_DIR" # 2. Initialize project @@ -64,6 +65,16 @@ EOF # 4. Create the Venv with Hard Copies uv venv .venv --python "$PYTHON_VERSION" --seed --link-mode copy +# 4.1. The "Encodings" Fix: Ensure pyvenv.cfg is correct +# We need to tell Python that the 'home' is the venv bin directory +cat < .venv/pyvenv.cfg +home = $APP_DIR/.venv/bin +include-system-site-packages = false +version = $PYTHON_VERSION +executable = $APP_DIR/.venv/bin/python +command = $UV_MANAGED_DIR/bin/uv venv .venv --python $PYTHON_VERSION --seed --link-mode copy +EOF + # 5. Sync dependencies source .venv/bin/activate uv sync --link-mode copy @@ -75,6 +86,12 @@ if [ -L ".venv/bin/python" ]; then cp "$REAL_PYTHON" .venv/bin/python fi +# 6.1. Verify the Library structure +# Python needs the 'lib' folder in the same parent as 'bin' +if [ ! -d ".venv/lib" ] && [ -d ".venv/lib64" ]; then + ln -s lib64 .venv/lib +fi + # 7. Optional: Relocatable Shebangs if [ "$MAKE_RELOCATABLE" -eq 1 ]; then find .venv/bin -maxdepth 1 -type f -executable -exec \