Skip to content

Commit

Permalink
Merge pull request #1047 from stealthycoin/support-multiple-local-dep…
Browse files Browse the repository at this point in the history
…endencies

Fix local package installation
  • Loading branch information
stealthycoin authored Jan 14, 2019
2 parents 9f20ec2 + b67eaf0 commit 8426d4c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
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

0 comments on commit 8426d4c

Please sign in to comment.