Skip to content

Commit 0d7e776

Browse files
authored
Updated regex to match newer pip output (#490)
1 parent d1054ea commit 0d7e776

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

aws_lambda_builders/workflows/python_pip/packager.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,11 @@ class PipRunner(object):
661661
# Update regex pattern to correspond with the updated output from pip
662662
# Specific commit:
663663
# https://github.com/pypa/pip/commit/b28e2c4928cc62d90b738a4613886fb1e2ad6a81#diff-5225c8e359020adb25dfc8c7a505950fd649c6c5775789c6f6517f7913f94542L529
664-
_LINK_IS_DIR_PATTERNS = ["Processing (.+?)\n"]
664+
#
665+
# Commit that adds extra info to the end:
666+
# https://github.com/pypa/pip/commit/c546c99480875cfe4cdeaefa6d16bad9998d0f70#diff-5225c8e359020adb25dfc8c7a505950fd649c6c5775789c6f6517f7913f94542R275-R281
667+
# eg. Processing ./package_a (from 123==1.1.1->-r requirements.txt (line 1))
668+
_LINK_IS_DIR_PATTERNS = ["Processing (.+?)[ ,\n]"]
665669

666670
def __init__(self, python_exe, pip, osutils=None):
667671
if osutils is None:

tests/unit/workflows/python_pip/test_packager.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,13 @@ def test_does_find_local_directory(self, pip_factory):
270270
assert len(pip.calls) == 2
271271
assert pip.calls[1].args == ["wheel", "--no-deps", "--wheel-dir", "directory", "../local-dir"]
272272

273+
def test_does_find_local_nested_directory(self, pip_factory):
274+
pip, runner = pip_factory()
275+
pip.add_return((0, b"Processing ../local-nested-dir (from xyz==123 and other info here)\n", b""))
276+
runner.download_all_dependencies("requirements.txt", "directory")
277+
assert len(pip.calls) == 2
278+
assert pip.calls[1].args == ["wheel", "--no-deps", "--wheel-dir", "directory", "../local-nested-dir"]
279+
273280
def test_does_find_multiple_local_directories(self, pip_factory):
274281
pip, runner = pip_factory()
275282
pip.add_return(

0 commit comments

Comments
 (0)