@@ -13,10 +13,16 @@ BbPromise.promisifyAll(fse);
13
13
* Inject requirements into packaged application.
14
14
* @param {string } requirementsPath requirements folder path
15
15
* @param {string } packagePath target package path
16
+ * @param {string } injectionRelativePath installation directory in target package
16
17
* @param {Object } options our options object
17
18
* @return {Promise } the JSZip object constructed.
18
19
*/
19
- function injectRequirements ( requirementsPath , packagePath , options ) {
20
+ function injectRequirements (
21
+ requirementsPath ,
22
+ packagePath ,
23
+ injectionRelativePath ,
24
+ options
25
+ ) {
20
26
const noDeploy = new Set ( options . noDeploy || [ ] ) ;
21
27
22
28
return fse
@@ -29,7 +35,13 @@ function injectRequirements(requirementsPath, packagePath, options) {
29
35
dot : true ,
30
36
} )
31
37
)
32
- . map ( ( file ) => [ file , path . relative ( requirementsPath , file ) ] )
38
+ . map ( ( file ) => [
39
+ file ,
40
+ path . join (
41
+ injectionRelativePath ,
42
+ path . relative ( requirementsPath , file )
43
+ ) ,
44
+ ] )
33
45
. filter (
34
46
( [ file , relativeFile ] ) =>
35
47
! file . endsWith ( '/' ) &&
@@ -101,6 +113,11 @@ async function injectAllRequirements(funcArtifact) {
101
113
this . serverless . cli . log ( 'Injecting required Python packages to package...' ) ;
102
114
}
103
115
116
+ let injectionRelativePath = '.' ;
117
+ if ( this . serverless . service . provider . name == 'scaleway' ) {
118
+ injectionRelativePath = 'package' ;
119
+ }
120
+
104
121
try {
105
122
if ( this . serverless . service . package . individually ) {
106
123
await BbPromise . resolve ( this . targetFuncs )
@@ -138,13 +155,15 @@ async function injectAllRequirements(funcArtifact) {
138
155
: injectRequirements (
139
156
path . join ( '.serverless' , func . module , 'requirements' ) ,
140
157
func . package . artifact ,
158
+ injectionRelativePath ,
141
159
this . options
142
160
) ;
143
161
} ) ;
144
162
} else if ( ! this . options . zip ) {
145
163
await injectRequirements (
146
164
path . join ( '.serverless' , 'requirements' ) ,
147
165
this . serverless . service . package . artifact || funcArtifact ,
166
+ injectionRelativePath ,
148
167
this . options
149
168
) ;
150
169
}
0 commit comments