Skip to content

Commit

Permalink
DONT MERGE
Browse files Browse the repository at this point in the history
  • Loading branch information
threeal committed Jan 29, 2023
1 parent 4fc2b6c commit a116398
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
11 changes: 7 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,16 @@ function getCacheKey(packageName) {
async function cachePackage(packageInfo) {
const loc = await getSitePackages();
await cache.saveCache([
path.join(loc, packageInfo.name.toLowerCase()),
path.join(loc, `${packageInfo.name}-${packageInfo.version}.dist-info`),
path.join(loc, `${packageInfo.name.toLowerCase()}*`),
path.join(loc, `${packageInfo.name}*`),
], getCacheKey(packageInfo.name));
}
async function restorePackage(packageName) {
const loc = path.join(await getSitePackages(), "*");
const key = await cache.restoreCache([loc], getCacheKey(packageName));
const loc = await getSitePackages();
const key = await cache.restoreCache([
path.join(loc, `${packageName.toLowerCase()}*`),
path.join(loc, `${packageName}*`),
], getCacheKey(packageName));
return key !== undefined;
}
async function isPackageExist(packageName) {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions src/deps/pip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,22 @@ async function cachePackage(packageInfo: PackageInfo): Promise<void> {
const loc = await getSitePackages();
await cache.saveCache(
[
path.join(loc, packageInfo.name.toLowerCase()),
path.join(loc, `${packageInfo.name}-${packageInfo.version}.dist-info`),
path.join(loc, `${packageInfo.name.toLowerCase()}*`),
path.join(loc, `${packageInfo.name}*`),
],
getCacheKey(packageInfo.name)
);
}

async function restorePackage(packageName: string): Promise<boolean> {
const loc = path.join(await getSitePackages(), "*");
const key = await cache.restoreCache([loc], getCacheKey(packageName));
const loc = await getSitePackages();
const key = await cache.restoreCache(
[
path.join(loc, `${packageName.toLowerCase()}*`),
path.join(loc, `${packageName}*`),
],
getCacheKey(packageName)
);
return key !== undefined;
}

Expand Down

0 comments on commit a116398

Please sign in to comment.