Skip to content

Instantly share code, notes, and snippets.

@novas0x2a
Created March 7, 2023 20:14
Show Gist options
  • Save novas0x2a/98801bb5e82478f8411d8a0a0362fc53 to your computer and use it in GitHub Desktop.
Save novas0x2a/98801bb5e82478f8411d8a0a0362fc53 to your computer and use it in GitHub Desktop.
Repro poetry bug
#!/bin/bash
set -xeuo pipefail
TESTDIR=${1:?[$0 <test-dir>]}
POETRY=${2:-1.4.0}
PYTHON=${PYTHON:-python3}
setup_poetry() {
local venv_path=$1
local poetry_version=$2
$PYTHON -m venv "$venv_path"
"$venv_path"/bin/python -m pip install pip==23.0.1 setuptools==67.5.1
"$venv_path"/bin/python -m pip install poetry=="$poetry_version"
}
setup_project() {
local proj_path=$1
mkdir "$proj_path"
cat <<EOF > "$proj_path"/pyproject.toml
[tool.poetry]
name = "test-dir"
version = "0.1.0"
description = ""
authors = ["Mike Lundy <mike@fluffypenguin.org>"]
[tool.poetry.dependencies]
python = "^3.8 || ^3.10"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
EOF
cat <<EOF > "$proj_path"/poetry.toml
[virtualenvs]
in-project = true
EOF
cat <<EOF > "$proj_path"/poetry.lock
# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand.
package = []
[metadata]
lock-version = "2.0"
python-versions = "^3.8 || ^3.10"
content-hash = "a3f9d76a42e66f7af8f64f0ca7044a17b35ff17e1206ca3cff422b60e85f51e5"
EOF
}
if test -e "$TESTDIR"; then
echo "$TESTDIR exists, bailing out" >&2
exit 1
fi
mkdir -p "$TESTDIR"
setup_poetry "$TESTDIR/poetry" "$POETRY"
setup_project "$TESTDIR/project"
cd "$TESTDIR/project"
../poetry/bin/poetry debug info
../poetry/bin/poetry install -vvv --sync --dry-run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment