Skip to content

Commit 15c4381

Browse files
author
Didier SENMARTIN
committed
add useFinalCopy option
1 parent 3edf0e0 commit 15c4381

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

Diff for: README.md

+12
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,18 @@ functions:
416416
vendor: ./hello-vendor # The option is also available at the function level
417417
```
418418

419+
### Copy dependencies instead of linking
420+
421+
Before final packaging, a link is created in .serverless folder for python dependencies.
422+
If it is not possible to create a symbolic link, dependencies can be copied instead of linked
423+
whith the foloowing option:
424+
425+
```yaml
426+
custom:
427+
pythonRequirements:
428+
useFinalCopy: true
429+
```
430+
419431
## Manual invocations
420432

421433
The `.requirements` and `requirements.zip`(if using zip support) files are left

Diff for: index.js

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class ServerlessPythonRequirements {
5858
pipCmdExtraArgs: [],
5959
noDeploy: [],
6060
vendor: '',
61+
useFinalCopy: false,
6162
},
6263
(this.serverless.service.custom &&
6364
this.serverless.service.custom.pythonRequirements) ||

Diff for: lib/pip.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,9 @@ async function installAllRequirements() {
778778
reqsInstalledAt != symlinkPath
779779
) {
780780
// Windows can't symlink so we have to use junction on Windows
781-
if (process.platform == 'win32') {
781+
if (this.serverless.service.custom.pythonRequirements.useFinalCopy) {
782+
fse.copySync(reqsInstalledAt, symlinkPath);
783+
} else if (process.platform == 'win32') {
782784
fse.symlink(reqsInstalledAt, symlinkPath, 'junction');
783785
} else {
784786
fse.symlink(reqsInstalledAt, symlinkPath);

0 commit comments

Comments
 (0)