mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-25 14:13:38 +00:00
Auto merge of #10973 - flip1995:fix-version-py-script, r=flip1995
Fix version.py after deleting v* dirs I missed updating this file. I also ran black and isort over it. Fixes the [deployment failure](https://github.com/rust-lang/rust-clippy/actions/runs/5297071588/jobs/9588599397) r? `@ghost` changelog: none
This commit is contained in:
commit
965f4a8492
@ -1,24 +1,27 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import logging as log
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import logging as log
|
|
||||||
log.basicConfig(level=log.INFO, format='%(levelname)s: %(message)s')
|
log.basicConfig(level=log.INFO, format="%(levelname)s: %(message)s")
|
||||||
|
|
||||||
|
|
||||||
def key(v):
|
def key(v):
|
||||||
if v == 'master':
|
if v == "master":
|
||||||
return float('inf')
|
return float("inf")
|
||||||
if v == 'stable':
|
if v == "stable":
|
||||||
return sys.maxsize
|
return sys.maxsize
|
||||||
if v == 'beta':
|
if v == "beta":
|
||||||
return sys.maxsize - 1
|
return sys.maxsize - 1
|
||||||
|
if v == "pre-1.29.0":
|
||||||
|
return -1
|
||||||
|
|
||||||
v = v.replace('v', '').replace('rust-', '')
|
v = v.replace("rust-", "")
|
||||||
|
|
||||||
s = 0
|
s = 0
|
||||||
for i, val in enumerate(v.split('.')[::-1]):
|
for i, val in enumerate(v.split(".")[::-1]):
|
||||||
s += int(val) * 100**i
|
s += int(val) * 100**i
|
||||||
|
|
||||||
return s
|
return s
|
||||||
@ -31,7 +34,11 @@ def main():
|
|||||||
|
|
||||||
outdir = sys.argv[1]
|
outdir = sys.argv[1]
|
||||||
versions = [
|
versions = [
|
||||||
dir for dir in os.listdir(outdir) if not dir.startswith(".") and os.path.isdir(os.path.join(outdir, dir))
|
dir
|
||||||
|
for dir in os.listdir(outdir)
|
||||||
|
if not dir.startswith(".")
|
||||||
|
and not dir.startswith("v")
|
||||||
|
and os.path.isdir(os.path.join(outdir, dir))
|
||||||
]
|
]
|
||||||
versions.sort(key=key)
|
versions.sort(key=key)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user