Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit 5dc20c5

Browse files
jaysonsantosThomas Pansino
authored andcommitted
Fix poetry generated requirements.txt for git dependencies
1 parent 16d0fa1 commit 5dc20c5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/poetry.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,19 @@ function pyprojectTomlToRequirements() {
3232
if (res.status !== 0) {
3333
throw new Error(res.stderr);
3434
}
35+
36+
const editableLine = new RegExp(/^-e /gm);
37+
const sourceRequirements = path.join(this.servicePath, 'requirements.txt');
38+
const requirementsContents = fse.readFileSync(sourceRequirements, { encoding: 'utf-8' });
39+
40+
if (requirementsContents.match(editableLine)) {
41+
this.serverless.cli.log('The generated file contains -e lines, removing them...');
42+
fse.writeFileSync(sourceRequirements, requirementsContents.replace(editableLine, ''))
43+
}
44+
3545
fse.ensureDirSync(path.join(this.servicePath, '.serverless'));
3646
fse.moveSync(
37-
path.join(this.servicePath, 'requirements.txt'),
47+
sourceRequirements,
3848
path.join(this.servicePath, '.serverless', 'requirements.txt')
3949
);
4050
}

0 commit comments

Comments
 (0)