diff --git a/aws_lambda_builders/__init__.py b/aws_lambda_builders/__init__.py index f38463afc..f9b942ea8 100644 --- a/aws_lambda_builders/__init__.py +++ b/aws_lambda_builders/__init__.py @@ -1,5 +1,5 @@ """ AWS Lambda Builder Library """ -__version__ = '0.0.2' +__version__ = '0.0.3-dev' RPC_PROTOCOL_VERSION = "0.1" diff --git a/aws_lambda_builders/workflows/python_pip/packager.py b/aws_lambda_builders/workflows/python_pip/packager.py index d9c78cd74..9cda81084 100644 --- a/aws_lambda_builders/workflows/python_pip/packager.py +++ b/aws_lambda_builders/workflows/python_pip/packager.py @@ -5,6 +5,7 @@ import sys import re import subprocess +import logging from email.parser import FeedParser @@ -14,6 +15,8 @@ from .compat import pip_no_compile_c_shim from .utils import OSUtils +LOG = logging.getLogger(__name__) + # TODO update the wording here MISSING_DEPENDENCIES_TEMPLATE = r""" @@ -229,6 +232,9 @@ def _download_dependencies(self, directory, requirements_filename): else: incompatible_wheels.add(package) + LOG.debug("initial compatible: %s", compatible_wheels) + LOG.debug("initial incompatible: %s", incompatible_wheels | sdists) + # Next we need to go through the downloaded packages and pick out any # dependencies that do not have a compatible wheel file downloaded. # For these packages we need to explicitly try to download a @@ -242,6 +248,10 @@ def _download_dependencies(self, directory, requirements_filename): # file ourselves. compatible_wheels, incompatible_wheels = self._categorize_wheel_files( directory) + LOG.debug( + "compatible wheels after second download pass: %s", + compatible_wheels + ) missing_wheels = sdists - compatible_wheels self._build_sdists(missing_wheels, directory, compile_c=True) @@ -255,6 +265,10 @@ def _download_dependencies(self, directory, requirements_filename): # compiler. compatible_wheels, incompatible_wheels = self._categorize_wheel_files( directory) + LOG.debug( + "compatible after building wheels (no C compiling): %s", + compatible_wheels + ) missing_wheels = sdists - compatible_wheels self._build_sdists(missing_wheels, directory, compile_c=False) @@ -264,6 +278,10 @@ def _download_dependencies(self, directory, requirements_filename): # compatible version directly and building from source. compatible_wheels, incompatible_wheels = self._categorize_wheel_files( directory) + LOG.debug( + "compatible after building wheels (C compiling): %s", + compatible_wheels + ) # Now there is still the case left over where the setup.py has been # made in such a way to be incompatible with python's setup tools, @@ -273,6 +291,9 @@ def _download_dependencies(self, directory, requirements_filename): compatible_wheels, incompatible_wheels = self._apply_wheel_whitelist( compatible_wheels, incompatible_wheels) missing_wheels = deps - compatible_wheels + LOG.debug("Final compatible: %s", compatible_wheels) + LOG.debug("Final incompatible: %s", incompatible_wheels) + LOG.debug("Final missing wheels: %s", missing_wheels) return compatible_wheels, missing_wheels @@ -285,14 +306,18 @@ def _download_all_dependencies(self, requirements_filename, directory): self._pip.download_all_dependencies(requirements_filename, directory) deps = {Package(directory, filename) for filename in self._osutils.get_directory_contents(directory)} + LOG.debug("Full dependency closure: %s", deps) return deps def _download_binary_wheels(self, packages, directory): # Try to get binary wheels for each package that isn't compatible. + LOG.debug("Downloading missing wheels: %s", packages) self._pip.download_manylinux_wheels( [pkg.identifier for pkg in packages], directory) def _build_sdists(self, sdists, directory, compile_c=True): + LOG.debug("Build missing wheels from sdists " + "(C compiling %s): %s", compile_c, sdists) for sdist in sdists: path_to_sdist = self._osutils.joinpath(directory, sdist.filename) self._pip.build_wheel(path_to_sdist, directory, compile_c) @@ -537,6 +562,7 @@ def __init__(self, pip, osutils=None): def _execute(self, command, args, env_vars=None, shim=None): """Execute a pip command with the given arguments.""" main_args = [command] + args + LOG.debug("calling pip %s", ' '.join(main_args)) rc, out, err = self._wrapped_pip.main(main_args, env_vars=env_vars, shim=shim) return rc, out, err