Skip to content

Commit

Permalink
Merge branch 'compat-yaml'
Browse files Browse the repository at this point in the history
* compat-yaml:
  Add entry to changelog
  Add PyYAML to compatible package whitelist
  • Loading branch information
jamesls committed Feb 27, 2019
2 parents 5a073c7 + 10c496a commit 283380a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
CHANGELOG
=========

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

* Fall back to pure python version of yaml parser
when unable to compile C bindings for PyYAML.
(`#1074 <https://github.com/aws/chalice/issues/1074>`__)


1.7.0
=====

Expand Down
3 changes: 2 additions & 1 deletion chalice/deploy/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ class DependencyBuilder(object):
_MANYLINUX_COMPATIBLE_PLATFORM = {'any', 'linux_x86_64',
'manylinux1_x86_64'}
_COMPATIBLE_PACKAGE_WHITELIST = {
'sqlalchemy'
'sqlalchemy',
'pyyaml',
}

def __init__(self, osutils, pip_runner=None):
Expand Down
23 changes: 17 additions & 6 deletions tests/functional/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,17 @@ def test_can_replace_incompat_whl(self, tmpdir, osutils, pip_runner):
for req in reqs:
assert req in installed_packages

def test_whitelist_sqlalchemy(self, tmpdir, osutils, pip_runner):
reqs = ['sqlalchemy==1.1.18']
@pytest.mark.parametrize(
'package,package_filename', [
# package: The name you would provide in requirements.txt
# package_filename: The package name used in the .whl file.
('sqlalchemy', 'SQLAlchemy'),
('pyyaml', 'PyYAML'),
]
)
def test_whitelist_sqlalchemy(self, tmpdir, osutils, pip_runner,
package, package_filename):
reqs = ['%s==1.1.18' % package]
abi = 'cp36m'
pip, runner = pip_runner
appdir, builder = self._make_appdir_and_dependency_builder(
Expand All @@ -651,26 +660,28 @@ def test_whitelist_sqlalchemy(self, tmpdir, osutils, pip_runner):
pip.packages_to_download(
expected_args=['-r', requirements_file, '--dest', mock.ANY],
packages=[
'SQLAlchemy-1.1.18-cp36-cp36m-macosx_10_11_x86_64.whl'
'%s-1.1.18-cp36-cp36m-macosx_10_11_x86_64.whl'
% package_filename
]
)
pip.packages_to_download(
expected_args=[
'--only-binary=:all:', '--no-deps', '--platform',
'manylinux1_x86_64', '--implementation', 'cp',
'--abi', abi, '--dest', mock.ANY,
'sqlalchemy==1.1.18'
'%s==1.1.18' % package
],
packages=[
'SQLAlchemy-1.1.18-cp36-cp36m-macosx_10_11_x86_64.whl'
'%s-1.1.18-cp36-cp36m-macosx_10_11_x86_64.whl'
% package_filename
]
)
site_packages = os.path.join(appdir, '.chalice.', 'site-packages')
builder.build_site_packages(abi, requirements_file, site_packages)
installed_packages = os.listdir(site_packages)

pip.validate()
assert installed_packages == ['SQLAlchemy']
assert installed_packages == [package_filename]

def test_can_build_sdist(self, tmpdir, osutils, pip_runner):
reqs = ['foo', 'bar']
Expand Down

0 comments on commit 283380a

Please sign in to comment.