forked from bandophahita/selenium-axe-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_axe_core.py
More file actions
executable file
·33 lines (24 loc) · 959 Bytes
/
Copy pathupdate_axe_core.py
File metadata and controls
executable file
·33 lines (24 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python3
"""
Run this jsfile to grab the latest version of the axe.min.js from axe-core
"""
from __future__ import annotations
from urllib.request import urlretrieve
jsfile = "./selenium_axe_python/axe-core/axe.min.js"
verfile = "./selenium_axe_python/axe-core/version.txt"
rt = urlretrieve("https://unpkg.com/axe-core/axe.min.js", jsfile)
with open(jsfile) as fp:
ver = fp.readline().split("v", maxsplit=1)[-1].strip()
with open(verfile, "w") as fp:
fp.write(ver)
ver_line = "**This version of selenium-axe-python is using axe-core@"
new_line = f"**This version of selenium-axe-python is using axe-core@{ver}**\n"
with open("README.md") as fp:
readmelines = fp.readlines()
with open("README.md", "w") as fp:
for line in readmelines:
if ver_line in line and new_line != line:
print(f"Replacing:\n\t{line}\nwith:\n\t{new_line}")
fp.write(new_line)
else:
fp.write(line)