Skip to content

Commit 94d71a1

Browse files
Didier SENMARTINPsycholive
Didier SENMARTIN
authored andcommitted
add useFinalCopy option
1 parent 915bcad commit 94d71a1

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,18 @@ functions:
428428
vendor: ./hello-vendor # The option is also available at the function level
429429
```
430430

431+
### Copy dependencies instead of linking
432+
433+
Before final packaging, a link is created in .serverless folder for python dependencies.
434+
If it is not possible to create a symbolic link, dependencies can be copied instead of linked
435+
whith the foloowing option:
436+
437+
```yaml
438+
custom:
439+
pythonRequirements:
440+
useFinalCopy: true
441+
```
442+
431443
## Manual invocations
432444

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

index.js

Lines changed: 1 addition & 0 deletions
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) ||

lib/pip.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,9 @@ async function installAllRequirements() {
782782
reqsInstalledAt != symlinkPath
783783
) {
784784
// Windows can't symlink so we have to use junction on Windows
785-
if (process.platform == 'win32') {
785+
if (this.serverless.service.custom.pythonRequirements.useFinalCopy) {
786+
fse.copySync(reqsInstalledAt, symlinkPath);
787+
} else if (process.platform == 'win32') {
786788
fse.symlink(reqsInstalledAt, symlinkPath, 'junction');
787789
} else {
788790
fse.symlink(reqsInstalledAt, symlinkPath);

0 commit comments

Comments
 (0)