File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 1
1
const fse = require ( 'fs-extra' ) ;
2
2
const path = require ( 'path' ) ;
3
3
const { spawnSync } = require ( 'child_process' ) ;
4
+ const { EOL } = require ( 'os' ) ;
4
5
5
6
/**
6
7
* pipenv install
@@ -36,8 +37,24 @@ function pipfileToRequirements() {
36
37
fse . ensureDirSync ( path . join ( this . servicePath , '.serverless' ) ) ;
37
38
fse . writeFileSync (
38
39
path . join ( this . servicePath , '.serverless/requirements.txt' ) ,
39
- res . stdout
40
+ removeEditableFlagFromRequirementsString ( res . stdout )
40
41
) ;
41
42
}
42
43
44
+ /**
45
+ *
46
+ * @param requirementBuffer
47
+ * @returns Buffer with editable flags remove
48
+ */
49
+ function removeEditableFlagFromRequirementsString ( requirementBuffer ) {
50
+ const flagStr = '-e ' ;
51
+ const lines = requirementBuffer . toString ( 'utf8' ) . split ( EOL ) ;
52
+ for ( let i = 0 ; i < lines . length ; i ++ ) {
53
+ if ( lines [ i ] . startsWith ( flagStr ) ) {
54
+ lines [ i ] = lines [ i ] . substring ( flagStr . length ) ;
55
+ }
56
+ }
57
+ return Buffer . from ( lines . join ( EOL ) ) ;
58
+ }
59
+
43
60
module . exports = { pipfileToRequirements } ;
You can’t perform that action at this time.
0 commit comments