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

Add option for copying dependencies instead of creating a link #685

Open
wants to merge 3 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,18 @@ functions:
vendor: ./hello-vendor # The option is also available at the function level
```

### Copy dependencies instead of linking

Before final packaging, a link is created in .serverless folder for python dependencies.
If it is not possible for the OS to create a symbolic link, dependencies can be copied,
instead of linked, with the following option:

```yaml
custom:
pythonRequirements:
useSymlinks: false
```

## Manual invocations

The `.requirements` and `requirements.zip`(if using zip support) files are left
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class ServerlessPythonRequirements {
pipCmdExtraArgs: [],
noDeploy: [],
vendor: '',
useSymlinks: true,
},
(this.serverless.service.custom &&
this.serverless.service.custom.pythonRequirements) ||
Expand Down
4 changes: 3 additions & 1 deletion lib/pip.js
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,9 @@ async function installAllRequirements() {
reqsInstalledAt != symlinkPath
) {
// Windows can't symlink so we have to use junction on Windows
if (process.platform == 'win32') {
if (!this.serverless.service.custom.pythonRequirements.useSymlinks) {
fse.copySync(reqsInstalledAt, symlinkPath);
} else if (process.platform == 'win32') {
fse.symlink(reqsInstalledAt, symlinkPath, 'junction');
} else {
fse.symlink(reqsInstalledAt, symlinkPath);
Expand Down