Add basic dev/bootstrap scripts and config
This commit is contained in:
parent
a1da468629
commit
4980e5784b
5 changed files with 407 additions and 0 deletions
45
dev/bootstrap.py
Normal file
45
dev/bootstrap.py
Normal file
|
@ -0,0 +1,45 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Bootstrap development for Theo
|
||||
"""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
def bootstrap():
|
||||
|
||||
if not inside_virtualenv():
|
||||
return
|
||||
|
||||
# install invoke, sphinx
|
||||
subprocess.run(['pip', 'install', 'invoke', 'Sphinx'],
|
||||
check=True)
|
||||
|
||||
# run bootstrap task
|
||||
os.chdir(here)
|
||||
try:
|
||||
completed = subprocess.run(['invoke', '--echo', 'bootstrap'])
|
||||
except KeyboardInterrupt:
|
||||
sys.exit(130) # 128 + SIGINT
|
||||
else:
|
||||
sys.exit(completed.returncode)
|
||||
|
||||
|
||||
def inside_virtualenv():
|
||||
if not (hasattr(sys, 'real_prefix') or
|
||||
(hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix)):
|
||||
print("\nNot running inside a virtual environment!\n\n"
|
||||
"Please create and activate that first, e.g. like:\n\n"
|
||||
" python -m venv /srv/envs/theo\n"
|
||||
" source /srv/envs/theo/bin/activate\n")
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
bootstrap()
|
Loading…
Add table
Add a link
Reference in a new issue