@@ -6,46 +6,17 @@ const { writeZip, addTree } = require('./zipTree');
6
6
7
7
BbPromise . promisifyAll ( fse ) ;
8
8
9
- /**
10
- * Get the paths for the compatible runtimes of the layer
11
- * @param {string[] } list of runtime paths
12
- */
13
- function getRunTimeBuildPaths ( ) {
14
- const runtimepaths = {
15
- 'python2.7' : 'python' ,
16
- 'python3.6' : path . join ( 'python' , 'lib' , 'python3.6' , 'site-packages' ) ,
17
- 'python3.7' : path . join ( 'python' , 'lib' , 'python3.7' , 'site-packages' )
18
- } ;
19
-
20
- let runtimes = [ ] ;
21
-
22
- // Defer to Layer config first
23
- if ( this . options . layer . compatibleRuntimes ) {
24
- runtimes = this . options . layer . compatibleRuntimes ;
25
- // If none provided, assume the provider runtime
26
- } else if ( this . serverless . service . provider . runtime ) {
27
- runtimes = [ this . serverless . service . provider . runtime ] ;
28
- // If still no runtime found, just assume latest python
29
- } else {
30
- runtimes = [ 'python3.7' ] ;
31
- }
32
-
33
- return BbPromise . resolve ( runtimes . map ( runtime => runtimepaths [ runtime ] ) ) ;
34
- }
35
-
36
9
/**
37
10
* Zip up requirements to be used as layer package.
38
- * @param {string[] } list of paths where the requirements should be put in the layer
39
11
* @return {Promise } the JSZip object constructed.
40
12
*/
41
- function zipRequirements ( runtimepaths ) {
13
+ function zipRequirements ( ) {
42
14
const rootZip = new JSZip ( ) ;
43
15
const src = path . join ( '.serverless' , 'requirements' ) ;
16
+ const runtimepath = 'python' ;
44
17
45
- return BbPromise . each ( runtimepaths , runtimepath =>
46
- addTree ( rootZip . folder ( runtimepath ) , src )
47
- ) . then ( ( ) =>
48
- writeZip ( rootZip , path . join ( '.serverless' , 'pythonRequirementsLayer.zip' ) )
18
+ return addTree ( rootZip . folder ( runtimepath ) , src ) . then ( ( ) =>
19
+ writeZip ( rootZip , path . join ( '.serverless' , 'pythonRequirements.zip' ) )
49
20
) ;
50
21
}
51
22
@@ -80,7 +51,6 @@ function layerRequirements() {
80
51
this . serverless . cli . log ( 'Packaging Python Requirements Lambda Layer...' ) ;
81
52
82
53
return BbPromise . bind ( this )
83
- . then ( getRunTimeBuildPaths )
84
54
. then ( zipRequirements )
85
55
. then ( createLayers ) ;
86
56
}
0 commit comments