Skip to content

Commit

Permalink
Parse values from poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick91 committed Jan 31, 2022
1 parent b190eb8 commit 0f8afe0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions dist/setup/index.js
Expand Up @@ -38663,7 +38663,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 @@ -38695,7 +38695,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
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

0 comments on commit 0f8afe0

Please sign in to comment.