Skip to content

Commit edd541c

Browse files
authored
Add support for poetry sync (#82)
1 parent 067de35 commit edd541c

File tree

6 files changed

+381
-223
lines changed

6 files changed

+381
-223
lines changed

.github/workflows/test.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,11 @@ jobs:
9292
python-version: "3.10"
9393
- name: Install Poetry
9494
run: |
95-
curl -sSL https://install.python-poetry.org | python3 - --version ${{ matrix.poetry-version }}
96-
export PATH="$HOME/.local/bin:$PATH"
95+
pip install poetry==${{ matrix.poetry-version }}
96+
if [ "${{ matrix.poetry-version }}" = "1.7.0" ] || [ "${{ matrix.poetry-version }}" = "1.8.0" ]; then
97+
# Known issue with virtualenv 20.31.x breaking these Poetry versions
98+
pip install virtualenv==20.30.0
99+
fi
97100
- name: Install dependencies
98101
run: |
99102
pip install -r requirements.txt

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ docs:
5656
pdoc --docformat google ./scfw > /dev/null &
5757

5858
clean:
59-
rm -rf .mypy_cache .pytest_cache .coverage*
59+
rm -rf .mypy_cache .pytest_cache .coverage* build scfw.egg-info
6060
find . -name '__pycache__' -print0 | xargs -0 rm -rf
6161

6262
.PHONY: checks clean coverage install install-dev test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ $ scfw configure
5858
| :---------------: | :-------------------: | :---------------------------: |
5959
| npm | >= 7.0 | `install` (including aliases) |
6060
| pip | >= 22.2 | `install` |
61-
| poetry | >= 1.7 | `add`, `install` |
61+
| poetry | >= 1.7 | `add`, `install`, `sync` |
6262

6363
In keeping with its goal of blocking 100% of known-malicious package installations, `scfw` will refuse to run with an incompatible version of a supported package manager. Please upgrade to or verify that you are running a compatible version before using this tool.
6464

scfw/commands/poetry_command.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
_log = logging.getLogger(__name__)
1919

20-
MIN_POETRY_VERSION = version_parse("1.3.0")
20+
MIN_POETRY_VERSION = version_parse("1.7.0")
21+
22+
INSPECTED_SUBCOMMANDS = {"add", "install", "sync"}
2123

2224

2325
class PoetryCommand(PackageManagerCommand):
@@ -112,7 +114,7 @@ def line_to_install_target(line: str) -> Optional[InstallTarget]:
112114
return InstallTarget(self.ecosystem(), match.group(2), get_target_version(match.group(3)))
113115
return None
114116

115-
if not any(subcommand in self._command for subcommand in {"add", "install"}):
117+
if not any(subcommand in self._command for subcommand in INSPECTED_SUBCOMMANDS):
116118
return []
117119

118120
# The presence of these options prevent the add command from running

0 commit comments

Comments
 (0)