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

Follow symlinks in chalicelib (resolves #696) #1875

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion chalice/deploy/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ def _iter_chalice_lib_if_needed(self, project_dir):
# type: (str) -> Iterator[Tuple[str, str]]
libdir = self._osutils.joinpath(project_dir, self._CHALICE_LIB_DIR)
if self._osutils.directory_exists(libdir):
for rootdir, _, filenames in self._osutils.walk(libdir):
for rootdir, _, filenames in self._osutils.walk(libdir,
followlinks=True):
for filename in filenames:
fullpath = self._osutils.joinpath(rootdir, filename)
zip_path = self._osutils.joinpath(
Expand Down
14 changes: 14 additions & 0 deletions tests/functional/test_deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,20 @@ def test_subsequent_deploy_replaces_vendor_dir(tmpdir, chalice_deployer):
_assert_in_zip('mypackage/__init__.py', b'# v2', f)


@slow
def test_chalicelib_symlink_included(tmpdir, chalice_deployer):
appdir = _create_app_structure(tmpdir)
extra_package = tmpdir.mkdir('mypackage')
extra_package.join('__init__.py').write('# Test package')
chalicelib = appdir.mkdir('chalicelib')
os.symlink(str(extra_package), str(chalicelib.join('otherpackage')))
name = chalice_deployer.create_deployment_package(
str(appdir), 'python2.7')
with zipfile.ZipFile(name) as f:
_assert_in_zip('chalicelib/otherpackage/__init__.py',
b'# Test package', f)


@slow
def test_vendor_symlink_included(tmpdir, chalice_deployer):
appdir = _create_app_structure(tmpdir)
Expand Down