You've already forked setup-python
							
							
				mirror of
				https://github.com/actions/setup-python.git
				synced 2025-10-31 07:06:25 +07:00 
			
		
		
		
	Add another pip default dependency file for cache hash (#604)
This commit is contained in:
		 Evgenii Korolevskii
					Evgenii Korolevskii
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							869e769ec8
						
					
				
				
					commit
					7b9ef6fc5a
				
			
							
								
								
									
										23
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										23
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							| @ -59699,6 +59699,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||
| exports.State = void 0; | ||||
| const cache = __importStar(__nccwpck_require__(7799)); | ||||
| const core = __importStar(__nccwpck_require__(2186)); | ||||
| const constants_1 = __nccwpck_require__(8248); | ||||
| var State; | ||||
| (function (State) { | ||||
|     State["STATE_CACHE_PRIMARY_KEY"] = "cache-primary-key"; | ||||
| @ -59718,9 +59719,12 @@ class CacheDistributor { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
|             const { primaryKey, restoreKey } = yield this.computeKeys(); | ||||
|             if (primaryKey.endsWith('-')) { | ||||
|                 throw new Error(`No file in ${process.cwd()} matched to [${this.cacheDependencyPath | ||||
|                     .split('\n') | ||||
|                     .join(',')}], make sure you have checked out the target repository`);
 | ||||
|                 const file = this.packageManager === 'pip' | ||||
|                     ? `${this.cacheDependencyPath | ||||
|                         .split('\n') | ||||
|                         .join(',')} or ${constants_1.CACHE_DEPENDENCY_BACKUP_PATH}` | ||||
|                     : this.cacheDependencyPath.split('\n').join(','); | ||||
|                 throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository`); | ||||
|             } | ||||
|             const cachePath = yield this.getCacheGlobalDirectories(); | ||||
|             core.saveState(State.CACHE_PATHS, cachePath); | ||||
| @ -59744,6 +59748,19 @@ class CacheDistributor { | ||||
| exports["default"] = CacheDistributor; | ||||
| 
 | ||||
| 
 | ||||
| /***/ }), | ||||
| 
 | ||||
| /***/ 8248: | ||||
| /***/ ((__unused_webpack_module, exports) => { | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||
| exports.CACHE_DEPENDENCY_BACKUP_PATH = void 0; | ||||
| const CACHE_DEPENDENCY_BACKUP_PATH = '**/pyproject.toml'; | ||||
| exports.CACHE_DEPENDENCY_BACKUP_PATH = CACHE_DEPENDENCY_BACKUP_PATH; | ||||
| 
 | ||||
| 
 | ||||
| /***/ }), | ||||
| 
 | ||||
| /***/ 4553: | ||||
|  | ||||
							
								
								
									
										28
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										28
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							| @ -65775,6 +65775,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||
| exports.State = void 0; | ||||
| const cache = __importStar(__nccwpck_require__(7799)); | ||||
| const core = __importStar(__nccwpck_require__(2186)); | ||||
| const constants_1 = __nccwpck_require__(8248); | ||||
| var State; | ||||
| (function (State) { | ||||
|     State["STATE_CACHE_PRIMARY_KEY"] = "cache-primary-key"; | ||||
| @ -65794,9 +65795,12 @@ class CacheDistributor { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
|             const { primaryKey, restoreKey } = yield this.computeKeys(); | ||||
|             if (primaryKey.endsWith('-')) { | ||||
|                 throw new Error(`No file in ${process.cwd()} matched to [${this.cacheDependencyPath | ||||
|                     .split('\n') | ||||
|                     .join(',')}], make sure you have checked out the target repository`);
 | ||||
|                 const file = this.packageManager === 'pip' | ||||
|                     ? `${this.cacheDependencyPath | ||||
|                         .split('\n') | ||||
|                         .join(',')} or ${constants_1.CACHE_DEPENDENCY_BACKUP_PATH}` | ||||
|                     : this.cacheDependencyPath.split('\n').join(','); | ||||
|                 throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository`); | ||||
|             } | ||||
|             const cachePath = yield this.getCacheGlobalDirectories(); | ||||
|             core.saveState(State.CACHE_PATHS, cachePath); | ||||
| @ -65856,6 +65860,19 @@ function getCacheDistributor(packageManager, pythonVersion, cacheDependencyPath) | ||||
| exports.getCacheDistributor = getCacheDistributor; | ||||
| 
 | ||||
| 
 | ||||
| /***/ }), | ||||
| 
 | ||||
| /***/ 8248: | ||||
| /***/ ((__unused_webpack_module, exports) => { | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| Object.defineProperty(exports, "__esModule", ({ value: true })); | ||||
| exports.CACHE_DEPENDENCY_BACKUP_PATH = void 0; | ||||
| const CACHE_DEPENDENCY_BACKUP_PATH = '**/pyproject.toml'; | ||||
| exports.CACHE_DEPENDENCY_BACKUP_PATH = CACHE_DEPENDENCY_BACKUP_PATH; | ||||
| 
 | ||||
| 
 | ||||
| /***/ }), | ||||
| 
 | ||||
| /***/ 5546: | ||||
| @ -65904,10 +65921,12 @@ const path = __importStar(__nccwpck_require__(1017)); | ||||
| const os_1 = __importDefault(__nccwpck_require__(2037)); | ||||
| const cache_distributor_1 = __importDefault(__nccwpck_require__(8953)); | ||||
| const utils_1 = __nccwpck_require__(1314); | ||||
| const constants_1 = __nccwpck_require__(8248); | ||||
| class PipCache extends cache_distributor_1.default { | ||||
|     constructor(pythonVersion, cacheDependencyPath = '**/requirements.txt') { | ||||
|         super('pip', cacheDependencyPath); | ||||
|         this.pythonVersion = pythonVersion; | ||||
|         this.cacheDependencyBackupPath = constants_1.CACHE_DEPENDENCY_BACKUP_PATH; | ||||
|     } | ||||
|     getCacheGlobalDirectories() { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
| @ -65943,7 +65962,8 @@ class PipCache extends cache_distributor_1.default { | ||||
|     } | ||||
|     computeKeys() { | ||||
|         return __awaiter(this, void 0, void 0, function* () { | ||||
|             const hash = yield glob.hashFiles(this.cacheDependencyPath); | ||||
|             const hash = (yield glob.hashFiles(this.cacheDependencyPath)) || | ||||
|                 (yield glob.hashFiles(this.cacheDependencyBackupPath)); | ||||
|             let primaryKey = ''; | ||||
|             let restoreKey = ''; | ||||
|             if (utils_1.IS_LINUX) { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user