Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

URL dependencies are not included in lambda dist #23

Open
Haapalaj opened this issue Oct 28, 2016 · 1 comment
Open

URL dependencies are not included in lambda dist #23

Haapalaj opened this issue Oct 28, 2016 · 1 comment

Comments

@Haapalaj
Copy link

Haapalaj commented Oct 28, 2016

When adding and URL dependency to project as runtime dependency, e.g.
in build.py init phase: project.depends_on(modulename, url="file://" + .tar.gz)
so it is expected to be installed to target/lambda_dependencies dir, but this won't work.

It seems that in lambda_tasks.prepare_dependencies_dir the dependencies
are fetch by build_install_dependencies_string(project).
and the build_install_dependencies_string(project) excludes URL dependencies.

How this should be resolved, either to workaround build_install_dependencies_string in lambda_tasks
or modify the actual build_install_dependencies_string?

We resolved this by adding additional function to our build which installs all URL dependencies:

def include_url_dependencies(project, logger, target_directory):
    """ Installs url dependencies to target_directory.  """
    dependencies = [
        dependency for dependency in project.dependencies if dependency.url]
    if not dependencies:
        return ""

    pip_cmd = 'pip install --target {0} {1}'
    for dependency in dependencies:

        cmd = pip_cmd.format(target_directory, dependency.url)
        logger.info("Installing url-dependency {0}: '{1}'".format(dependency.url, cmd))

        process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
        process.communicate()
        if process.returncode != 0:
            msg = "Command '{0}' failed to install dependency: {1}".format(
                    cmd, process.returncode)
            raise Exception(msg)
@esc
Copy link
Contributor

esc commented Oct 31, 2016

Sure, please provide a pull-request and this may get merged.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants