Attept to fix the Netlify site error with Python.

This commit is contained in:
vince 2022-02-21 09:26:50 -05:00
parent 7ff3979888
commit 76b0cf4100
1 changed files with 12 additions and 4 deletions

View File

@ -7,17 +7,25 @@ import subprocess
def build_docs(input_dir: str, output_dir: str):
subprocess.call('mkdocs build', shell=True, cwd=input_dir)
subprocess.call('python3 -m pip install --upgrade pip', shell=True, cwd=input_dir)
subprocess.call('python3 -m pip install mkdocs', shell=True, cwd=input_dir)
subprocess.call('python3 -m mkdocs build', shell=True, cwd=input_dir)
site_dir = os.path.join(input_dir, 'site')
shutil.copytree(site_dir, output_dir)
def main() -> None:
if os.path.exists('site'):
os.removedirs('site')
if os.path.exists('site'):
if os.path.isfile('site') or os.path.islink('site'):
os.unlink('site')
else:
shutil.rmtree('site')
os.mkdir('site')
build_docs('./docs/en', output_dir='site/en')
# get the path of the current directory
docs_path = os.path.join(os.getcwd(), "docs/en")
print(docs_path)
build_docs(docs_path, output_dir='site/en')
if __name__ == '__main__':