Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 58362bf

Browse filesBrowse files
committed
poetry: Run poetry env use only after cache is loaded
The virtualenv cache might contain invalid entries, such as virtualenvs built in previous, buggy versions of this action. The `poetry env use` command will recreate virtualenvs in case they are invalid, but it has to be run only *after* the cache is loaded. Refactor `CacheDistributor` a bit such that the validation (and possible recreation) of virtualenvs happens only after the cache is loaded.
1 parent bc3992e commit 58362bf
Copy full SHA for 58362bf

File tree

Expand file treeCollapse file tree

4 files changed

+206
-220
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+206
-220
lines changed

‎dist/cache-save/index.js

Copy file name to clipboardExpand all lines: dist/cache-save/index.js
+73-93Lines changed: 73 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -45304,10 +45304,10 @@ function populateMaps (extensions, types) {
4530445304
module.exports = minimatch
4530545305
minimatch.Minimatch = Minimatch
4530645306

45307-
var path = (function () { try { return __nccwpck_require__(1017) } catch (e) {}}()) || {
45308-
sep: '/'
45309-
}
45310-
minimatch.sep = path.sep
45307+
var path = { sep: '/' }
45308+
try {
45309+
path = __nccwpck_require__(1017)
45310+
} catch (er) {}
4531145311

4531245312
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
4531345313
var expand = __nccwpck_require__(3717)
@@ -45359,64 +45359,43 @@ function filter (pattern, options) {
4535945359
}
4536045360

4536145361
function ext (a, b) {
45362+
a = a || {}
4536245363
b = b || {}
4536345364
var t = {}
45364-
Object.keys(a).forEach(function (k) {
45365-
t[k] = a[k]
45366-
})
4536745365
Object.keys(b).forEach(function (k) {
4536845366
t[k] = b[k]
4536945367
})
45368+
Object.keys(a).forEach(function (k) {
45369+
t[k] = a[k]
45370+
})
4537045371
return t
4537145372
}
4537245373

4537345374
minimatch.defaults = function (def) {
45374-
if (!def || typeof def !== 'object' || !Object.keys(def).length) {
45375-
return minimatch
45376-
}
45375+
if (!def || !Object.keys(def).length) return minimatch
4537745376

4537845377
var orig = minimatch
4537945378

4538045379
var m = function minimatch (p, pattern, options) {
45381-
return orig(p, pattern, ext(def, options))
45380+
return orig.minimatch(p, pattern, ext(def, options))
4538245381
}
4538345382

4538445383
m.Minimatch = function Minimatch (pattern, options) {
4538545384
return new orig.Minimatch(pattern, ext(def, options))
4538645385
}
45387-
m.Minimatch.defaults = function defaults (options) {
45388-
return orig.defaults(ext(def, options)).Minimatch
45389-
}
45390-
45391-
m.filter = function filter (pattern, options) {
45392-
return orig.filter(pattern, ext(def, options))
45393-
}
45394-
45395-
m.defaults = function defaults (options) {
45396-
return orig.defaults(ext(def, options))
45397-
}
45398-
45399-
m.makeRe = function makeRe (pattern, options) {
45400-
return orig.makeRe(pattern, ext(def, options))
45401-
}
45402-
45403-
m.braceExpand = function braceExpand (pattern, options) {
45404-
return orig.braceExpand(pattern, ext(def, options))
45405-
}
45406-
45407-
m.match = function (list, pattern, options) {
45408-
return orig.match(list, pattern, ext(def, options))
45409-
}
4541045386

4541145387
return m
4541245388
}
4541345389

4541445390
Minimatch.defaults = function (def) {
45391+
if (!def || !Object.keys(def).length) return Minimatch
4541545392
return minimatch.defaults(def).Minimatch
4541645393
}
4541745394

4541845395
function minimatch (p, pattern, options) {
45419-
assertValidPattern(pattern)
45396+
if (typeof pattern !== 'string') {
45397+
throw new TypeError('glob pattern string required')
45398+
}
4542045399

4542145400
if (!options) options = {}
4542245401

@@ -45425,6 +45404,9 @@ function minimatch (p, pattern, options) {
4542545404
return false
4542645405
}
4542745406

45407+
// "" only matches ""
45408+
if (pattern.trim() === '') return p === ''
45409+
4542845410
return new Minimatch(pattern, options).match(p)
4542945411
}
4543045412

@@ -45433,14 +45415,15 @@ function Minimatch (pattern, options) {
4543345415
return new Minimatch(pattern, options)
4543445416
}
4543545417

45436-
assertValidPattern(pattern)
45418+
if (typeof pattern !== 'string') {
45419+
throw new TypeError('glob pattern string required')
45420+
}
4543745421

4543845422
if (!options) options = {}
45439-
4544045423
pattern = pattern.trim()
4544145424

4544245425
// windows support: need to use /, not \
45443-
if (!options.allowWindowsEscape && path.sep !== '/') {
45426+
if (path.sep !== '/') {
4544445427
pattern = pattern.split(path.sep).join('/')
4544545428
}
4544645429

@@ -45451,7 +45434,6 @@ function Minimatch (pattern, options) {
4545145434
this.negate = false
4545245435
this.comment = false
4545345436
this.empty = false
45454-
this.partial = !!options.partial
4545545437

4545645438
// make the set of regexps etc.
4545745439
this.make()
@@ -45461,6 +45443,9 @@ Minimatch.prototype.debug = function () {}
4546145443

4546245444
Minimatch.prototype.make = make
4546345445
function make () {
45446+
// don't do it more than once.
45447+
if (this._made) return
45448+
4546445449
var pattern = this.pattern
4546545450
var options = this.options
4546645451

@@ -45480,7 +45465,7 @@ function make () {
4548045465
// step 2: expand braces
4548145466
var set = this.globSet = this.braceExpand()
4548245467

45483-
if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) }
45468+
if (options.debug) this.debug = console.error
4548445469

4548545470
this.debug(this.pattern, set)
4548645471

@@ -45560,29 +45545,19 @@ function braceExpand (pattern, options) {
4556045545
pattern = typeof pattern === 'undefined'
4556145546
? this.pattern : pattern
4556245547

45563-
assertValidPattern(pattern)
45548+
if (typeof pattern === 'undefined') {
45549+
throw new TypeError('undefined pattern')
45550+
}
4556445551

45565-
// Thanks to Yeting Li <https://github.com/yetingli> for
45566-
// improving this regexp to avoid a ReDOS vulnerability.
45567-
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
45552+
if (options.nobrace ||
45553+
!pattern.match(/\{.*\}/)) {
4556845554
// shortcut. no need to expand.
4556945555
return [pattern]
4557045556
}
4557145557

4557245558
return expand(pattern)
4557345559
}
4557445560

45575-
var MAX_PATTERN_LENGTH = 1024 * 64
45576-
var assertValidPattern = function (pattern) {
45577-
if (typeof pattern !== 'string') {
45578-
throw new TypeError('invalid pattern')
45579-
}
45580-
45581-
if (pattern.length > MAX_PATTERN_LENGTH) {
45582-
throw new TypeError('pattern is too long')
45583-
}
45584-
}
45585-
4558645561
// parse a component of the expanded set.
4558745562
// At this point, no pattern may contain "/" in it
4558845563
// so we're going to return a 2d array, where each entry is the full
@@ -45597,17 +45572,14 @@ var assertValidPattern = function (pattern) {
4559745572
Minimatch.prototype.parse = parse
4559845573
var SUBPARSE = {}
4559945574
function parse (pattern, isSub) {
45600-
assertValidPattern(pattern)
45575+
if (pattern.length > 1024 * 64) {
45576+
throw new TypeError('pattern is too long')
45577+
}
4560145578

4560245579
var options = this.options
4560345580

4560445581
// shortcuts
45605-
if (pattern === '**') {
45606-
if (!options.noglobstar)
45607-
return GLOBSTAR
45608-
else
45609-
pattern = '*'
45610-
}
45582+
if (!options.noglobstar && pattern === '**') return GLOBSTAR
4561145583
if (pattern === '') return ''
4561245584

4561345585
var re = ''
@@ -45663,12 +45635,10 @@ function parse (pattern, isSub) {
4566345635
}
4566445636

4566545637
switch (c) {
45666-
/* istanbul ignore next */
45667-
case '/': {
45638+
case '/':
4566845639
// completely not allowed, even escaped.
4566945640
// Should already be path-split by now.
4567045641
return false
45671-
}
4567245642

4567345643
case '\\':
4567445644
clearStateChar()
@@ -45787,23 +45757,25 @@ function parse (pattern, isSub) {
4578745757

4578845758
// handle the case where we left a class open.
4578945759
// "[z-a]" is valid, equivalent to "\[z-a\]"
45790-
// split where the last [ was, make sure we don't have
45791-
// an invalid re. if so, re-walk the contents of the
45792-
// would-be class to re-translate any characters that
45793-
// were passed through as-is
45794-
// TODO: It would probably be faster to determine this
45795-
// without a try/catch and a new RegExp, but it's tricky
45796-
// to do safely. For now, this is safe and works.
45797-
var cs = pattern.substring(classStart + 1, i)
45798-
try {
45799-
RegExp('[' + cs + ']')
45800-
} catch (er) {
45801-
// not a valid class!
45802-
var sp = this.parse(cs, SUBPARSE)
45803-
re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
45804-
hasMagic = hasMagic || sp[1]
45805-
inClass = false
45806-
continue
45760+
if (inClass) {
45761+
// split where the last [ was, make sure we don't have
45762+
// an invalid re. if so, re-walk the contents of the
45763+
// would-be class to re-translate any characters that
45764+
// were passed through as-is
45765+
// TODO: It would probably be faster to determine this
45766+
// without a try/catch and a new RegExp, but it's tricky
45767+
// to do safely. For now, this is safe and works.
45768+
var cs = pattern.substring(classStart + 1, i)
45769+
try {
45770+
RegExp('[' + cs + ']')
45771+
} catch (er) {
45772+
// not a valid class!
45773+
var sp = this.parse(cs, SUBPARSE)
45774+
re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
45775+
hasMagic = hasMagic || sp[1]
45776+
inClass = false
45777+
continue
45778+
}
4580745779
}
4580845780

4580945781
// finish up the class.
@@ -45887,7 +45859,9 @@ function parse (pattern, isSub) {
4588745859
// something that could conceivably capture a dot
4588845860
var addPatternStart = false
4588945861
switch (re.charAt(0)) {
45890-
case '[': case '.': case '(': addPatternStart = true
45862+
case '.':
45863+
case '[':
45864+
case '(': addPatternStart = true
4589145865
}
4589245866

4589345867
// Hack to work around lack of negative lookbehind in JS
@@ -45949,7 +45923,7 @@ function parse (pattern, isSub) {
4594945923
var flags = options.nocase ? 'i' : ''
4595045924
try {
4595145925
var regExp = new RegExp('^' + re + '$', flags)
45952-
} catch (er) /* istanbul ignore next - should be impossible */ {
45926+
} catch (er) {
4595345927
// If it was an invalid regular expression, then it can't match
4595445928
// anything. This trick looks for a character after the end of
4595545929
// the string, which is of course impossible, except in multi-line
@@ -46007,7 +45981,7 @@ function makeRe () {
4600745981

4600845982
try {
4600945983
this.regexp = new RegExp(re, flags)
46010-
} catch (ex) /* istanbul ignore next - should be impossible */ {
45984+
} catch (ex) {
4601145985
this.regexp = false
4601245986
}
4601345987
return this.regexp
@@ -46025,8 +45999,8 @@ minimatch.match = function (list, pattern, options) {
4602545999
return list
4602646000
}
4602746001

46028-
Minimatch.prototype.match = function match (f, partial) {
46029-
if (typeof partial === 'undefined') partial = this.partial
46002+
Minimatch.prototype.match = match
46003+
function match (f, partial) {
4603046004
this.debug('match', f, this.pattern)
4603146005
// short-circuit in the case of busted things.
4603246006
// comments, etc.
@@ -46108,7 +46082,6 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
4610846082

4610946083
// should be impossible.
4611046084
// some invalid regexp stuff in the set.
46111-
/* istanbul ignore if */
4611246085
if (p === false) return false
4611346086

4611446087
if (p === GLOBSTAR) {
@@ -46182,7 +46155,6 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
4618246155
// no match was found.
4618346156
// However, in partial mode, we can't say this is necessarily over.
4618446157
// If there's more *pattern* left, then
46185-
/* istanbul ignore if */
4618646158
if (partial) {
4618746159
// ran out of file
4618846160
this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
@@ -46196,7 +46168,11 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
4619646168
// patterns with magic have been turned into regexps.
4619746169
var hit
4619846170
if (typeof p === 'string') {
46199-
hit = f === p
46171+
if (options.nocase) {
46172+
hit = f.toLowerCase() === p.toLowerCase()
46173+
} else {
46174+
hit = f === p
46175+
}
4620046176
this.debug('string match', p, f, hit)
4620146177
} else {
4620246178
hit = f.match(p)
@@ -46227,16 +46203,16 @@ Minimatch.prototype.matchOne = function (file, pattern, partial) {
4622746203
// this is ok if we're doing the match as part of
4622846204
// a glob fs traversal.
4622946205
return partial
46230-
} else /* istanbul ignore else */ if (pi === pl) {
46206+
} else if (pi === pl) {
4623146207
// ran out of pattern, still have file left.
4623246208
// this is only acceptable if we're on the very last
4623346209
// empty segment of a file with a trailing slash.
4623446210
// a/* should match a/b/
46235-
return (fi === fl - 1) && (file[fi] === '')
46211+
var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
46212+
return emptyFileEnd
4623646213
}
4623746214

4623846215
// should be unreachable.
46239-
/* istanbul ignore next */
4624046216
throw new Error('wtf?')
4624146217
}
4624246218

@@ -59711,6 +59687,9 @@ class CacheDistributor {
5971159687
this.cacheDependencyPath = cacheDependencyPath;
5971259688
this.CACHE_KEY_PREFIX = 'setup-python';
5971359689
}
59690+
handleLoadedCache() {
59691+
return __awaiter(this, void 0, void 0, function* () { });
59692+
}
5971459693
restoreCache() {
5971559694
return __awaiter(this, void 0, void 0, function* () {
5971659695
const { primaryKey, restoreKey } = yield this.computeKeys();
@@ -59723,6 +59702,7 @@ class CacheDistributor {
5972359702
core.saveState(State.CACHE_PATHS, cachePath);
5972459703
core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
5972559704
const matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
59705+
yield this.handleLoadedCache();
5972659706
this.handleMatchResult(matchedKey, primaryKey);
5972759707
});
5972859708
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.