mirror of
				https://kkgithub.com/actions/setup-python.git
				synced 2025-11-04 04:31:51 +08:00 
			
		
		
		
	Parse values from poetry
This commit is contained in:
		
							
								
								
									
										4
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							@ -38798,7 +38798,7 @@ class PoetryCache extends cache_distributor_1.default {
 | 
				
			|||||||
            const cacheDir = poetryConfig['cache-dir'];
 | 
					            const cacheDir = poetryConfig['cache-dir'];
 | 
				
			||||||
            const virtualenvsPath = poetryConfig['virtualenvs.path'].replace('{cache-dir}', cacheDir);
 | 
					            const virtualenvsPath = poetryConfig['virtualenvs.path'].replace('{cache-dir}', cacheDir);
 | 
				
			||||||
            const paths = [virtualenvsPath];
 | 
					            const paths = [virtualenvsPath];
 | 
				
			||||||
            if (poetryConfig['virtualenvs.in-project'] === 'true') {
 | 
					            if (poetryConfig['virtualenvs.in-project'] === true) {
 | 
				
			||||||
                paths.push(path.join(process.cwd(), '.venv'));
 | 
					                paths.push(path.join(process.cwd(), '.venv'));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return paths;
 | 
					            return paths;
 | 
				
			||||||
@ -38830,7 +38830,7 @@ class PoetryCache extends cache_distributor_1.default {
 | 
				
			|||||||
            for (let line of lines) {
 | 
					            for (let line of lines) {
 | 
				
			||||||
                line = line.replace(/#.*$/, '');
 | 
					                line = line.replace(/#.*$/, '');
 | 
				
			||||||
                const [key, value] = line.split('=').map(part => part.trim());
 | 
					                const [key, value] = line.split('=').map(part => part.trim());
 | 
				
			||||||
                config[key] = value;
 | 
					                config[key] = JSON.parse(value);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            return config;
 | 
					            return config;
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
				
			|||||||
@ -24,7 +24,7 @@ class PoetryCache extends CacheDistributor {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const paths = [virtualenvsPath];
 | 
					    const paths = [virtualenvsPath];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (poetryConfig['virtualenvs.in-project'] === 'true') {
 | 
					    if (poetryConfig['virtualenvs.in-project'] === true) {
 | 
				
			||||||
      paths.push(path.join(process.cwd(), '.venv'));
 | 
					      paths.push(path.join(process.cwd(), '.venv'));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -57,21 +57,21 @@ class PoetryCache extends CacheDistributor {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const lines = stdout.trim().split(os.EOL);
 | 
					    const lines = stdout.trim().split(os.EOL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const config = {} as {
 | 
					    const config: any = {};
 | 
				
			||||||
      'cache-dir': string;
 | 
					 | 
				
			||||||
      'virtualenvs.in-project': string;
 | 
					 | 
				
			||||||
      'virtualenvs.path': string;
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (let line of lines) {
 | 
					    for (let line of lines) {
 | 
				
			||||||
      line = line.replace(/#.*$/, '');
 | 
					      line = line.replace(/#.*$/, '');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const [key, value] = line.split('=').map(part => part.trim());
 | 
					      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;
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user