Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix local package installation #1047

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
CHANGELOG
=========

Next Release (TBD)
==================

* Fix packaging multiple local directories as dependencies
(`#1047 <https://github.com/aws/chalice/pull/1047>`__)


1.6.2
=====

Expand Down
4 changes: 2 additions & 2 deletions chalice/deploy/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,8 @@ def download_all_dependencies(self, requirements_filename, directory):
raise NoSuchPackageError(str(package_name))
raise PackageDownloadError(error)
stdout = out.decode()
match = re.search(self._LINK_IS_DIR_PATTERN, stdout)
if match:
matches = re.finditer(self._LINK_IS_DIR_PATTERN, stdout)
for match in matches:
wheel_package_path = str(match.group(1))
# Looks odd we do not check on the error status of building the
# wheel here. We can assume this is a valid package path since
Expand Down
30 changes: 30 additions & 0 deletions tests/unit/deploy/test_packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,36 @@ def test_download_wheels_no_wheels(self, pip_factory):
runner.download_manylinux_wheels('cp36m', [], 'directory')
assert len(pip.calls) == 0

def test_does_find_local_directory(self, pip_factory):
pip, runner = pip_factory()
pip.add_return((0,
(b"Processing ../local-dir\n"
b" Link is a directory,"
b" ignoring download_dir"),
b''))
runner.download_all_dependencies('requirements.txt', 'directory')
assert len(pip.calls) == 2
assert pip.calls[1].args == ['wheel', '--no-deps', '--wheel-dir',
'directory', '../local-dir']

def test_does_find_multiple_local_directories(self, pip_factory):
pip, runner = pip_factory()
pip.add_return((0,
(b"Processing ../local-dir-1\n"
b" Link is a directory,"
b" ignoring download_dir"
b"\nsome pip output...\n"
b"Processing ../local-dir-2\n"
b" Link is a directory,"
b" ignoring download_dir"),
b''))
runner.download_all_dependencies('requirements.txt', 'directory')
assert len(pip.calls) == 3
assert pip.calls[1].args == ['wheel', '--no-deps', '--wheel-dir',
'directory', '../local-dir-1']
assert pip.calls[2].args == ['wheel', '--no-deps', '--wheel-dir',
'directory', '../local-dir-2']

def test_raise_no_such_package_error(self, pip_factory):
pip, runner = pip_factory()
pip.add_return((1, b'',
Expand Down