From 7d9a99dc17934b2322124ee4fad1d147b12fe981 Mon Sep 17 00:00:00 2001 From: Stefan Freitag Date: Sat, 9 Dec 2023 22:16:05 +0100 Subject: [PATCH] fix: replace deprecated pipenv lock with pipenv requirements As part of the pipenv release 2022.8.13 the deprecated way of generating requirements "pipenv install -r" or "pipenv lock -r" has been removed in favor of the "pipenv requirements" command. * [Reference to pipenv CHANGELOG](https://github.com/pypa/pipenv/blob/main/CHANGELOG.md#2022813-2022-08-13) * [Refernce to relevant pipenv pull request](https://github.com/pypa/pipenv/pull/5200) Fixes #28015 by implementing the proposed change. --- packages/@aws-cdk/aws-lambda-python-alpha/lib/packaging.ts | 2 +- .../@aws-cdk/aws-lambda-python-alpha/test/bundling.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/@aws-cdk/aws-lambda-python-alpha/lib/packaging.ts b/packages/@aws-cdk/aws-lambda-python-alpha/lib/packaging.ts index 8bf8aaa6c036f..7875b3f15f83e 100644 --- a/packages/@aws-cdk/aws-lambda-python-alpha/lib/packaging.ts +++ b/packages/@aws-cdk/aws-lambda-python-alpha/lib/packaging.ts @@ -58,7 +58,7 @@ export class Packaging { dependenciesFile: DependenciesFile.PIPENV, // By default, pipenv creates a virtualenv in `/.local`, so we force it to create one in the package directory. // At the end, we remove the virtualenv to avoid creating a duplicate copy in the Lambda package. - exportCommand: `PIPENV_VENV_IN_PROJECT=1 pipenv lock -r > ${DependenciesFile.PIP} && rm -rf .venv`, + exportCommand: `PIPENV_VENV_IN_PROJECT=1 pipenv requirements > ${DependenciesFile.PIP} && rm -rf .venv`, }); } diff --git a/packages/@aws-cdk/aws-lambda-python-alpha/test/bundling.test.ts b/packages/@aws-cdk/aws-lambda-python-alpha/test/bundling.test.ts index 7a4d49bceecb3..a05fc4dab6834 100644 --- a/packages/@aws-cdk/aws-lambda-python-alpha/test/bundling.test.ts +++ b/packages/@aws-cdk/aws-lambda-python-alpha/test/bundling.test.ts @@ -193,7 +193,7 @@ test('Bundling a function with pipenv dependencies', () => { bundling: expect.objectContaining({ command: [ 'bash', '-c', - 'rsync -rLv /asset-input/ /asset-output/python && cd /asset-output/python && PIPENV_VENV_IN_PROJECT=1 pipenv lock -r > requirements.txt && rm -rf .venv && python -m pip install -r requirements.txt -t /asset-output/python', + 'rsync -rLv /asset-input/ /asset-output/python && cd /asset-output/python && PIPENV_VENV_IN_PROJECT=1 pipenv requirements > requirements.txt && rm -rf .venv && python -m pip install -r requirements.txt -t /asset-output/python', ], }), })); @@ -221,7 +221,7 @@ test('Bundling a function with pipenv dependencies with assetExcludes', () => { bundling: expect.objectContaining({ command: [ 'bash', '-c', - "rsync -rLv --exclude='.ignorefile' /asset-input/ /asset-output/python && cd /asset-output/python && PIPENV_VENV_IN_PROJECT=1 pipenv lock -r > requirements.txt && rm -rf .venv && python -m pip install -r requirements.txt -t /asset-output/python", + "rsync -rLv --exclude='.ignorefile' /asset-input/ /asset-output/python && cd /asset-output/python && PIPENV_VENV_IN_PROJECT=1 pipenv requirements > requirements.txt && rm -rf .venv && python -m pip install -r requirements.txt -t /asset-output/python", ], }), }));