-
-
Notifications
You must be signed in to change notification settings - Fork 195
Expand file tree
/
Copy pathsetup_help.py
More file actions
131 lines (76 loc) · 3.09 KB
/
setup_help.py
File metadata and controls
131 lines (76 loc) · 3.09 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/usr/bin/env python3
"""
Hydrus help docs builder.
"""
import argparse
import os
import sys
import subprocess
from pathlib import Path
def print_banner():
banner = ''' r::::::::::::::::::::::::::::::::::r
: :
: :PP. :
: vBBr :
: 7BB: :
: rBB: :
: :DQRE: rBB: :gMBb: :
: :BBBi rBB: 7BBB. :
: KBB: rBB: rBBI :
: qBB: rBB: rQBU :
: qBB: rBB: iBBS :
: qBB: iBB: 7BBj :
: iBBY iBB. 2BB. :
: SBQq iBQ: EBBY :
: :MQBZMBBDRBBP. :
: .YBB7 :
: :BB. :
: 7BBi :
: rBB: :
: :
r::::::::::::::::::::::::::::::::::r
hydrus
'''
print(banner)
def get_python_exe_path( venv_path ):
if sys.platform == 'win32':
python_exe = venv_path / 'Scripts' / 'python.exe'
else:
python_exe = venv_path / 'bin' / 'python'
return python_exe
def run_pip( cmd, venv_path ):
python_exe = get_python_exe_path( venv_path )
subprocess.check_call( [ str( python_exe ), '-m', 'pip' ] + cmd )
def build_help( venv_path ):
print( 'Checking mkdocs-material...' )
run_pip([ 'install', 'mkdocs-material==9.7.1' ], venv_path )
print( 'Building help...' )
python_exe = get_python_exe_path( venv_path )
subprocess.check_call( [ python_exe, '-m', 'mkdocs', 'build', '-d', 'help' ] )
def main():
try:
repo_root = Path( __file__ ).parent
os.chdir( repo_root )
argparser = argparse.ArgumentParser( description = 'hydrus network help setup' )
argparser.add_argument( '-v', '--venv_name', help = 'set the name of the venv folder (default=venv)' )
result = argparser.parse_args()
if result.venv_name is None:
venv_name = 'venv'
else:
venv_name = result.venv_name
venv_path = repo_root / venv_name
# Install dependencies
try:
build_help( venv_path )
except subprocess.CalledProcessError as e:
print( f'ERROR: Build failed: {e}' )
sys.exit(1)
print( '--------' )
print( 'Done!' )
print()
finally:
if sys.platform == 'win32':
# most Win users are double-clicking the file and would appreciate a moment to see the "Done!" conclusion before the window disappears
input( 'Hit enter to close...' )
if __name__ == "__main__":
main()