CircleCI-Public / python-orb

Common CircleCI tasks for the Python programming language.
https://circleci.com/developer/orbs/orb/circleci/python
MIT License
13 stars 37 forks source link

Installing poetry fails on MacOS #100

Closed ibackus-convoy closed 2 years ago

ibackus-convoy commented 2 years ago

Orb version:

2.0.3

What happened:

Using this config:

jobs:
  test:
    executor: macos
    working_directory: ~/work_dir
    steps:
      - checkout
      - python/install-packages:
          pkg-manager: poetry

# ...

executors:
  macos:
    macos:
      xcode: 13.3.1

Gives the error (during the link lockfile step):

#!/bin/bash --login -eo pipefail
# shellcheck source=detect-env.sh
source "$AUTO_DETECT_ENV_SCRIPT"

CACHE_DIR="/tmp/cci_pycache"
LOCKFILE_PATH="${CACHE_DIR}/lockfile"

mkdir -p "${CACHE_DIR}"

if [ ! -f "${LOCKFILE_PATH}" ]; then
    case ${DETECT_PKG_MNGR:-${PARAM_PKG_MNGR}} in
        pip | pip-dist)
            LOCK_FILE="${PARAM_DEPENDENCY_FILE:-requirements.txt}"
        ;;
        pipenv)
            LOCK_FILE="Pipfile.lock"
        ;;
        poetry)
            LOCK_FILE="poetry.lock"
        ;;
    esac

    if [ -z "${LOCK_FILE}" ]; then
        echo "WARNING: Could not determine lockfile path for ${DETECT_PKG_MNGR:-PARAM_PKG_MNGR}"
    else
        FULL_LOCK_FILE=$(readlink -f -v "${LOCK_FILE}")

        if [ -f "${LOCK_FILE}" ]; then
            echo "INFO: Copying ${FULL_LOCK_FILE} to ${LOCKFILE_PATH}"
            cp "${FULL_LOCK_FILE}" "${LOCKFILE_PATH}"
        else
            echo "WARNING: Could not find lockfile at ${LOCK_FILE}"
        fi
    fi
fi
readlink: illegal option -- v
usage: readlink [-fn] [file ...]

Exited with code exit status 1
CircleCI received exit code 1

Expected behavior:

Poetry should install without an exception

Jaryt commented 2 years ago

Hi! Thanks for reporting this. Will take a look asap :)

jkzilla commented 2 years ago

Pre-steps that could be helpful (docker example)

  build-and-test:
    docker:
      - image: cimg/python:3.7.4
    steps:
      - checkout
      - python/install-packages:
          pkg-manager: poetry
          app-dir: ~/project/web
          pre-install-steps:
            - run:
                name: Configure poetry
                command: |
                  pyenv exec pip install virtualenv==20.8.1
                  poetry self update $(cat .poetry-version)
                  poetry config virtualenvs.create true
                  poetry config virtualenvs.in-project true
      - run:
          name: Run tests
          command: |
            cd ~/project/web/django
            pytest
Jaryt commented 2 years ago

Hello! We have resolved these issues and incread MacOS support in v2.1.0. Please let us know how these changes fare for you!