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

Commit 49ab1f3

Browse files
authored
Merge branch 'master' into fix-resolve-requirements
2 parents 05d1819 + 7d3e263 commit 49ab1f3

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

lib/poetry.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ function pyprojectTomlToRequirements() {
3535

3636
const editableFlag = new RegExp(/^-e /gm);
3737
const sourceRequirements = path.join(this.servicePath, 'requirements.txt');
38-
const requirementsContents = fse.readFileSync(sourceRequirements, {
39-
encoding: 'utf-8'
40-
});
38+
const requirementsContents =
39+
res.stdout.toString().trim() || // As of poetry 1.0.0b1, requirements.txt is printed to standard output when the -o option is not specified.
40+
fse.readFileSync(sourceRequirements, {
41+
encoding: 'utf-8'
42+
});
4143

4244
if (requirementsContents.match(editableFlag)) {
4345
this.serverless.cli.log(

test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const sls = mkCommand('sls');
5151
const git = mkCommand('git');
5252
const npm = mkCommand('npm');
5353
const perl = mkCommand('perl');
54+
const poetry = mkCommand('poetry');
5455

5556
const setup = () => {
5657
removeSync(getUserCachePath());
@@ -1897,3 +1898,17 @@ test(
18971898
},
18981899
{ skip: !canUseDocker() }
18991900
);
1901+
1902+
// From this point on, the version of the poetry is 1.0.0a0
1903+
test('poetry1.0.0a0 py3.6 can package flask with default options', t => {
1904+
process.chdir('tests/poetry');
1905+
const path = npm(['pack', '../..']);
1906+
npm(['i', path]);
1907+
poetry(['self', 'update', '--preview', '1.0.0a0']);
1908+
sls(['package']);
1909+
const zipfiles = listZipFiles('.serverless/sls-py-req-test.zip');
1910+
t.true(zipfiles.includes(`flask${sep}__init__.py`), 'flask is packaged');
1911+
t.true(zipfiles.includes(`bottle.py`), 'bottle is packaged');
1912+
t.true(zipfiles.includes(`boto3${sep}__init__.py`), 'boto3 is packaged');
1913+
t.end();
1914+
});

0 commit comments

Comments
 (0)