Skip to content

Commit

Permalink
fix(lambda-python): asset files are generated inside the 'asset-input…
Browse files Browse the repository at this point in the history
…' folder (backport #18306) (#18341)

This is an automatic backport of pull request #18306 done by [Mergify](https://mergify.com).


---


<details>
<summary>Mergify commands and options</summary>

<br />

More conditions and actions can be found in the [documentation](https://docs.mergify.com/).

You can also trigger Mergify actions by commenting on this pull request:

- `@Mergifyio refresh` will re-evaluate the rules
- `@Mergifyio rebase` will rebase this PR on its base branch
- `@Mergifyio update` will merge the base branch into this PR
- `@Mergifyio backport <destination>` will backport this PR on `<destination>` branch

Additionally, on Mergify [dashboard](https://dashboard.mergify.com/) you can:

- look at your merge queues
- generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.com
</details>
  • Loading branch information
mergify[bot] authored Jan 10, 2022
1 parent 2d2ed06 commit a1715e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-lambda-python/lib/bundling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export class Bundling implements CdkBundlingOptions {
bundlingCommands.push(packaging.exportCommand ?? '');
if (packaging.dependenciesFile) {
bundlingCommands.push(`python -m pip install -r ${DependenciesFile.PIP} -t ${options.outputDir}`);
};
bundlingCommands.push(`cp -R ${options.inputDir} ${options.outputDir}`);
}
bundlingCommands.push(`cp -R ${options.inputDir}/ ${options.outputDir}`);
return bundlingCommands;
}
}
Expand Down
16 changes: 8 additions & 8 deletions packages/@aws-cdk/aws-lambda-python/test/bundling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test('Bundling a function without dependencies', () => {
bundling: expect.objectContaining({
command: [
'bash', '-c',
'cp -R /asset-input /asset-output',
'cp -R /asset-input/ /asset-output',
],
}),
}));
Expand All @@ -62,7 +62,7 @@ test('Bundling a function with requirements.txt', () => {
bundling: expect.objectContaining({
command: [
'bash', '-c',
'python -m pip install -r requirements.txt -t /asset-output && cp -R /asset-input /asset-output',
'python -m pip install -r requirements.txt -t /asset-output && cp -R /asset-input/ /asset-output',
],
}),
}));
Expand All @@ -81,7 +81,7 @@ test('Bundling Python 2.7 with requirements.txt installed', () => {
bundling: expect.objectContaining({
command: [
'bash', '-c',
'python -m pip install -r requirements.txt -t /asset-output && cp -R /asset-input /asset-output',
'python -m pip install -r requirements.txt -t /asset-output && cp -R /asset-input/ /asset-output',
],
}),
}));
Expand All @@ -101,7 +101,7 @@ test('Bundling a layer with dependencies', () => {
bundling: expect.objectContaining({
command: [
'bash', '-c',
'python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input /asset-output/python',
'python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input/ /asset-output/python',
],
}),
}));
Expand All @@ -121,7 +121,7 @@ test('Bundling a python code layer', () => {
bundling: expect.objectContaining({
command: [
'bash', '-c',
'cp -R /asset-input /asset-output/python',
'cp -R /asset-input/ /asset-output/python',
],
}),
}));
Expand All @@ -141,7 +141,7 @@ test('Bundling a function with pipenv dependencies', () => {
bundling: expect.objectContaining({
command: [
'bash', '-c',
'PIPENV_VENV_IN_PROJECT=1 pipenv lock -r > requirements.txt && rm -rf .venv && python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input /asset-output/python',
'PIPENV_VENV_IN_PROJECT=1 pipenv lock -r > requirements.txt && rm -rf .venv && python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input/ /asset-output/python',
],
}),
}));
Expand All @@ -161,7 +161,7 @@ test('Bundling a function with poetry dependencies', () => {
bundling: expect.objectContaining({
command: [
'bash', '-c',
'poetry export --with-credentials --format requirements.txt --output requirements.txt && python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input /asset-output/python',
'poetry export --with-credentials --format requirements.txt --output requirements.txt && python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input/ /asset-output/python',
],
}),
}));
Expand All @@ -184,7 +184,7 @@ test('Bundling a function with custom bundling image', () => {
image,
command: [
'bash', '-c',
'python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input /asset-output/python',
'python -m pip install -r requirements.txt -t /asset-output/python && cp -R /asset-input/ /asset-output/python',
],
}),
}));
Expand Down

0 comments on commit a1715e4

Please sign in to comment.