8000 Parse values from poetry · deep-soft/setup-python@42ed863 · GitHub
[go: up one dir, main page]

Skip to content

Commit 42ed863

Browse files
committed
Parse values from poetry
1 parent c275cf4 commit 42ed863

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

dist/setup/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38798,7 +38798,7 @@ class PoetryCache extends cache_distributor_1.default {
3879838798
const cacheDir = poetryConfig['cache-dir'];
3879938799
const virtualenvsPath = poetryConfig['virtualenvs.path'].replace('{cache-dir}', cacheDir);
3880038800
const paths = [virtualenvsPath];
38801-
if (poetryConfig['virtualenvs.in-project'] === 'true') {
38801+
if (poetryConfig['virtualenvs.in-project'] === true) {
3880238802
paths.push(path.join(process.cwd(), '.venv'));
3880338803
}
3880438804
return paths;
@@ -38830,7 +38830,7 @@ class PoetryCache extends cache_distributor_1.default {
3883038830
for (let line of lines) {
3883138831
line = line.replace(/#.*$/, '');
3883238832
const [key, value] = line.split('=').map(part => part.trim());
38833-
config[key] = value;
38833+
config[key] = JSON.parse(value);
3883438834
}
3883538835
return config;
3883638836
});

src/cache-distributions/poetry-cache.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class PoetryCache extends CacheDistributor {
2424

2525
const paths = [virtualenvsPath];
2626

27-
if (poetryConfig['virtualenvs.in-project'] === 'true') {
27+
if (poetryConfig['virtualenvs.in-project'] === true) {
2828
paths.push(path.join(process.cwd(), '.venv'));
2929
}
3030

@@ -57,21 +57,21 @@ class PoetryCache extends CacheDistributor {
5757

5858
const lines = stdout.trim().split(os.EOL);
5959

60-
const config = {} as {
61-
'cache-dir': string;
62-
'virtualenvs.in-project': string;
63-
'virtualenvs.path': string;
64-
};
60+
const config: any = {};
6561

6662
for (let line of lines) {
6763
line = line.replace(/#.*$/, '');
6864

6965
const [key, value] = line.split('=').map(part => part.trim());
7066

71-
config[key as keyof typeof config] = value;
67+
config[key] = JSON.parse(value);
7268
}
7369

74-
return config;
70+
return config as {
71+
'cache-dir': string;
72+
'virtualenvs.in-project': boolean;
73+
'virtualenvs.path': string;
74+
};
7575
}
7676
}
7777

0 commit comments

Comments
 (0)
0