@@ -133,19 +133,15 @@ async function pipAcceptsSystem(pythonBin) {
133133 * @param {Object } options
134134 * @return {undefined }
135135 */
136- async function installRequirements (
137- targetFolder ,
138- { options, serverless, log, progress }
139- ) {
136+ async function installRequirements ( targetFolder , pluginInstance ) {
137+ const { options, serverless, log, progress } = pluginInstance ;
140138 const targetRequirementsTxt = path . join ( targetFolder , 'requirements.txt' ) ;
141139
142140 let installProgress ;
143141 if ( progress ) {
142+ log . info ( `Installing requirements from "${ targetRequirementsTxt } "` ) ;
144143 installProgress = progress . get ( 'python-install' ) ;
145- installProgress . update (
146- `Installing requirements from "${ targetRequirementsTxt } "` ,
147- { isMainEvent : true }
148- ) ;
144+ installProgress . update ( 'Installing requirements' ) ;
149145 } else {
150146 serverless . cli . log (
151147 `Installing requirements from ${ targetRequirementsTxt } ...`
@@ -226,7 +222,7 @@ async function installRequirements(
226222 pipCmd . push ( '--cache-dir' , downloadCacheDir ) ;
227223 }
228224
229- if ( pipAcceptsSystem ( options . pythonBin ) ) {
225+ if ( await pipAcceptsSystem ( options . pythonBin ) ) {
230226 pipCmd . push ( '--system' ) ;
231227 }
232228 }
@@ -253,7 +249,7 @@ async function installRequirements(
253249 ) ;
254250 }
255251 try {
256- dockerImage = buildImage (
252+ dockerImage = await buildImage (
257253 options . dockerFile ,
258254 options . dockerBuildCmdExtraArgs
259255 ) ;
@@ -270,7 +266,9 @@ async function installRequirements(
270266 }
271267
272268 // Prepare bind path depending on os platform
273- const bindPath = dockerPathForWin ( getBindPath ( serverless , targetFolder ) ) ;
269+ const bindPath = dockerPathForWin (
270+ await getBindPath ( targetFolder , pluginInstance )
271+ ) ;
274272
275273 dockerCmd . push ( 'docker' , 'run' , '--rm' , '-v' , `${ bindPath } :/var/task:z` ) ;
276274 if ( options . dockerSsh ) {
@@ -308,7 +306,7 @@ async function installRequirements(
308306 fse . closeSync (
309307 fse . openSync ( path . join ( downloadCacheDir , 'requirements.txt' ) , 'w' )
310308 ) ;
311- const windowsized = getBindPath ( serverless , downloadCacheDir ) ;
309+ const windowsized = await getBindPath ( downloadCacheDir , pluginInstance ) ;
312310 // And now push it to a volume mount and to pip...
313311 dockerCmd . push ( '-v' , `${ windowsized } :${ dockerDownloadCacheDir } :z` ) ;
314312 pipCmd . push ( '--cache-dir' , dockerDownloadCacheDir ) ;
@@ -337,7 +335,7 @@ async function installRequirements(
337335 ] ) ;
338336 } else {
339337 // Use same user so --cache-dir works
340- dockerCmd . push ( '-u' , getDockerUid ( bindPath ) ) ;
338+ dockerCmd . push ( '-u' , await getDockerUid ( bindPath ) ) ;
341339 }
342340
343341 for ( let path of options . dockerExtraFiles ) {
@@ -716,9 +714,7 @@ async function installAllRequirements() {
716714 // If we didn't already process a module (functions can re-use modules)
717715 if ( ! doneModules . includes ( f . module ) ) {
718716 const reqsInstalledAt = await installRequirementsIfNeeded (
719- this . servicePath ,
720717 f . module ,
721- this . options ,
722718 f ,
723719 this . serverless
724720 ) ;
0 commit comments