-
Notifications
You must be signed in to change notification settings - Fork 2
/
installer.py
29 lines (21 loc) · 863 Bytes
/
installer.py
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
import os
from setuptools.command.install import install
import urllib.request
def download(url: str, file: str):
print(url, file)
response = urllib.request.urlopen(url)
data = response.read()
print(f' >> downloading {file}')
with open(file, 'wb') as f:
f.write(data)
class InstallWrapper(install):
def run(self):
libs_path = os.path.dirname(os.path.realpath(__file__)) + '/mkdocs_sequence_js_plugin/libs/'
if not os.path.exists(libs_path):
os.makedirs(libs_path)
os.chmod(libs_path, 0o777)
for file in ['webfont.js', 'snap.svg-min.js', 'underscore-min.js', 'sequence-diagram-min.js']:
download('https://bramp.github.io/js-sequence-diagrams/js/' + file, f'{libs_path}{file}')
if os.name != 'nt':
os.chmod(libs_path + file, 0o777)
install.run(self)