-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_docs.py
More file actions
executable file
·37 lines (27 loc) · 899 Bytes
/
generate_docs.py
File metadata and controls
executable file
·37 lines (27 loc) · 899 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
34
35
36
37
#!/usr/bin/python3
import os
def getDocsIgnoreArr(docsIgnoreFile=".docsignore"):
try:
with open(docsIgnoreFile) as fp:
lines = fp.readlines()
filesToIgnore = [line.strip() for line in lines]
except FileNotFoundError:
filesToIgnore = []
except Exception as e:
print("Error reading .docignore file", e)
return set(filesToIgnore)
def getAllPyFiles():
pyFiles = set()
dirname = "."
for filename in os.listdir(dirname):
if os.path.isfile(filename) and filename.endswith('.py'):
pyFiles.add(filename)
return pyFiles
filesToIgnore = getDocsIgnoreArr()
pyFiles = getAllPyFiles()
docsDir = "docs/"
filesToDocument = pyFiles.difference(filesToIgnore)
os.system(f"rm -rf {docsDir}")
for filename in filesToDocument:
# print(filename)
os.system(f"pdoc --html {filename} --force -o {docsDir}")