Commit
·
6ac7d7a
1
Parent(s):
1bac49a
small fixes
Browse files- run.sh +2 -0
- update-cpu-html.py +82 -0
- update-cuda-html.py +75 -0
run.sh
CHANGED
@@ -9,4 +9,6 @@ fi
|
|
9 |
./update-k2-doc-cpu-macos.py
|
10 |
./update-k2-doc-cpu-windows.py
|
11 |
./update-k2-doc-cuda-linux.py
|
|
|
|
|
12 |
|
|
|
9 |
./update-k2-doc-cpu-macos.py
|
10 |
./update-k2-doc-cpu-windows.py
|
11 |
./update-k2-doc-cuda-linux.py
|
12 |
+
./update-cpu-html.py
|
13 |
+
./update-cuda-html.py
|
14 |
|
update-cpu-html.py
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
import os
|
3 |
+
import re
|
4 |
+
from pathlib import Path
|
5 |
+
|
6 |
+
from update_readme import generate_url, get_all_files
|
7 |
+
|
8 |
+
|
9 |
+
def get_doc_dir():
|
10 |
+
k2_dir = os.getenv("K2_DIR")
|
11 |
+
if k2_dir is None:
|
12 |
+
raise ValueError("Please set the environment variable k2_dir")
|
13 |
+
|
14 |
+
return Path(k2_dir) / "docs"
|
15 |
+
|
16 |
+
|
17 |
+
class Wheel:
|
18 |
+
def __init__(self, full_name: str, url: str):
|
19 |
+
"""
|
20 |
+
Args:
|
21 |
+
full_name:
|
22 |
+
Example: k2-1.23.4.dev20230223+cpu.torch1.10.0-cp36-cp36m-linux_x86_64.whl
|
23 |
+
"""
|
24 |
+
self.full_name = full_name
|
25 |
+
# pattern = r"k2-(\d)\.(\d+)(\.(\d+))?\.dev(\d{8})+cpu\.torch(\d\.\d+)"
|
26 |
+
pattern = (
|
27 |
+
r"k2-(\d)\.(\d)+((\.)(\d))?\.dev(\d{8})\+cpu\.torch(\d\.\d+\.\d)-cp(\d+)"
|
28 |
+
)
|
29 |
+
m = re.search(pattern, full_name)
|
30 |
+
|
31 |
+
self.k2_major = int(m.group(1))
|
32 |
+
self.k2_minor = int(m.group(2))
|
33 |
+
self.k2_patch = int(m.group(5))
|
34 |
+
self.k2_date = int(m.group(6))
|
35 |
+
self.torch_version = m.group(7)
|
36 |
+
self.py_version = int(m.group(8))
|
37 |
+
self.url = url
|
38 |
+
|
39 |
+
def __str__(self):
|
40 |
+
return self.url
|
41 |
+
|
42 |
+
def __repr__(self):
|
43 |
+
return self.url
|
44 |
+
|
45 |
+
|
46 |
+
def sort_by_wheel(x: Wheel):
|
47 |
+
torch_major, torch_minor, torch_patch = x.torch_version.split(".")
|
48 |
+
torch_major = int(torch_major)
|
49 |
+
torch_minor = int(torch_minor)
|
50 |
+
torch_patch = int(torch_patch)
|
51 |
+
return (
|
52 |
+
x.k2_major,
|
53 |
+
x.k2_minor,
|
54 |
+
x.k2_patch,
|
55 |
+
x.k2_date,
|
56 |
+
torch_major,
|
57 |
+
torch_minor,
|
58 |
+
torch_patch,
|
59 |
+
x.py_version,
|
60 |
+
)
|
61 |
+
|
62 |
+
|
63 |
+
def main():
|
64 |
+
wheels = get_all_files("cpu", suffix="*.whl")
|
65 |
+
wheels += get_all_files("windows-cpu", suffix="*.whl")
|
66 |
+
wheels += get_all_files("macos", suffix="*.whl")
|
67 |
+
urls = generate_url(wheels)
|
68 |
+
|
69 |
+
wheels = []
|
70 |
+
for url in urls:
|
71 |
+
full_name = url.rsplit("/", maxsplit=1)[1]
|
72 |
+
wheels.append(Wheel(full_name, url))
|
73 |
+
|
74 |
+
wheels.sort(reverse=True, key=sort_by_wheel)
|
75 |
+
d = get_doc_dir()
|
76 |
+
with open(d / "source/cpu.html", "w") as f:
|
77 |
+
for w in wheels:
|
78 |
+
f.write(f'<a href="{w.url}">{w.full_name}</a><br/>\n')
|
79 |
+
|
80 |
+
|
81 |
+
if __name__ == "__main__":
|
82 |
+
main()
|
update-cuda-html.py
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python3
|
2 |
+
import os
|
3 |
+
import re
|
4 |
+
from pathlib import Path
|
5 |
+
|
6 |
+
from update_readme import generate_url, get_all_files
|
7 |
+
|
8 |
+
|
9 |
+
def get_doc_dir():
|
10 |
+
k2_dir = os.getenv("K2_DIR")
|
11 |
+
if k2_dir is None:
|
12 |
+
raise ValueError("Please set the environment variable k2_dir")
|
13 |
+
|
14 |
+
return Path(k2_dir) / "docs"
|
15 |
+
|
16 |
+
|
17 |
+
class Wheel:
|
18 |
+
def __init__(self, full_name: str, url: str):
|
19 |
+
"""
|
20 |
+
Args:
|
21 |
+
full_name:
|
22 |
+
Example: k2-1.23.4.dev20230224+cuda10.1.torch1.6.0-cp36-cp36m-linux_x86_64.whl
|
23 |
+
"""
|
24 |
+
self.full_name = full_name
|
25 |
+
pattern = r"k2-(\d)\.(\d)+((\.)(\d))?\.dev(\d{8})\+cuda(\d+)\.(\d+)\.torch(\d\.\d+\.\d)-cp(\d+)"
|
26 |
+
m = re.search(pattern, full_name)
|
27 |
+
|
28 |
+
self.k2_major = int(m.group(1))
|
29 |
+
self.k2_minor = int(m.group(2))
|
30 |
+
self.k2_patch = int(m.group(5))
|
31 |
+
self.k2_date = int(m.group(6))
|
32 |
+
self.cuda_major_version = int(m.group(7))
|
33 |
+
self.cuda_minor_version = int(m.group(8))
|
34 |
+
self.torch_version = m.group(9)
|
35 |
+
self.py_version = int(m.group(10))
|
36 |
+
self.url = url
|
37 |
+
|
38 |
+
|
39 |
+
def sort_by_wheel(x: Wheel):
|
40 |
+
torch_major, torch_minor, torch_patch = x.torch_version.split(".")
|
41 |
+
torch_major = int(torch_major)
|
42 |
+
torch_minor = int(torch_minor)
|
43 |
+
torch_patch = int(torch_patch)
|
44 |
+
return (
|
45 |
+
x.k2_major,
|
46 |
+
x.k2_minor,
|
47 |
+
x.k2_patch,
|
48 |
+
x.k2_date,
|
49 |
+
torch_major,
|
50 |
+
torch_minor,
|
51 |
+
torch_patch,
|
52 |
+
x.cuda_major_version,
|
53 |
+
x.cuda_minor_version,
|
54 |
+
x.py_version,
|
55 |
+
)
|
56 |
+
|
57 |
+
|
58 |
+
def main():
|
59 |
+
wheels = get_all_files("cuda", suffix="*.whl")
|
60 |
+
urls = generate_url(wheels)
|
61 |
+
|
62 |
+
wheels = []
|
63 |
+
for url in urls:
|
64 |
+
full_name = url.rsplit("/", maxsplit=1)[1]
|
65 |
+
wheels.append(Wheel(full_name, url))
|
66 |
+
|
67 |
+
wheels.sort(reverse=True, key=sort_by_wheel)
|
68 |
+
d = get_doc_dir()
|
69 |
+
with open(d / "source/cuda.html", "w") as f:
|
70 |
+
for w in wheels:
|
71 |
+
f.write(f'<a href="{w.url}">{w.full_name}</a><br/>\n')
|
72 |
+
|
73 |
+
|
74 |
+
if __name__ == "__main__":
|
75 |
+
main()
|