Add basic win32 support for dev bootstrap

This commit is contained in:
Lance Edgar 2021-01-27 17:03:24 -06:00
parent 4980e5784b
commit f6cf02bcaf
4 changed files with 73 additions and 21 deletions

View file

@ -12,10 +12,13 @@ here = os.path.abspath(os.path.dirname(__file__))
def bootstrap():
if not inside_virtualenv():
return
# install wheel
subprocess.run(['pip', 'install', 'wheel'],
check=True)
# install invoke, sphinx
subprocess.run(['pip', 'install', 'invoke', 'Sphinx'],
check=True)
@ -23,7 +26,10 @@ def bootstrap():
# run bootstrap task
os.chdir(here)
try:
completed = subprocess.run(['invoke', '--echo', 'bootstrap'])
if sys.platform == 'win32':
completed = subprocess.run(['invoke', 'bootstrap'])
else:
completed = subprocess.run(['invoke', '--echo', 'bootstrap'])
except KeyboardInterrupt:
sys.exit(130) # 128 + SIGINT
else:
@ -33,10 +39,18 @@ def bootstrap():
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")
print("")
print("Not running inside a virtual environment!")
print("")
print("Please create and activate that first, e.g. like:")
print("")
if sys.platform == 'win32':
print(" py -m venv C:\\envs\\theo")
print(" C:\\envs\\theo\\Scripts\\activate.bat")
else:
print(" python -m venv /srv/envs/theo")
print(" source /srv/envs/theo/bin/activate")
print("")
return False
return True