Skip to content
Prev Previous commit
Next Next commit
Parse values from poetry
  • Loading branch information
patrick91 committed Mar 26, 2022
commit 42ed863652de8e851824729c5540cb29a4bdddeb
4 changes: 2 additions & 2 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38798,7 +38798,7 @@ class PoetryCache extends cache_distributor_1.default {
const cacheDir = poetryConfig['cache-dir'];
const virtualenvsPath = poetryConfig['virtualenvs.path'].replace('{cache-dir}', cacheDir);
const paths = [virtualenvsPath];
if (poetryConfig['virtualenvs.in-project'] === 'true') {
if (poetryConfig['virtualenvs.in-project'] === true) {
paths.push(path.join(process.cwd(), '.venv'));
}
return paths;
Expand Down Expand Up @@ -38830,7 +38830,7 @@ class PoetryCache extends cache_distributor_1.default {
for (let line of lines) {
line = line.replace(/#.*$/, '');
const [key, value] = line.split('=').map(part => part.trim());
config[key] = value;
config[key] = JSON.parse(value);
}
return config;
});
Expand Down
16 changes: 8 additions & 8 deletions src/cache-distributions/poetry-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PoetryCache extends CacheDistributor {

const paths = [virtualenvsPath];

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

Expand Down Expand Up @@ -57,21 +57,21 @@ class PoetryCache extends CacheDistributor {

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

const config = {} as {
'cache-dir': string;
'virtualenvs.in-project': string;
'virtualenvs.path': string;
};
const config: any = {};

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

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

config[key as keyof typeof config] = value;
config[key] = JSON.parse(value);
}

return config;
return config as {
'cache-dir': string;
'virtualenvs.in-project': boolean;
'virtualenvs.path': string;
};
}
}

Expand Down