Add OS check, PS script (unfinished)

Added a check for your operating system and a PowerShell script which is unfinished at the moment.
pull/553/head
owengaspard 3 years ago
parent 565a8dd58f
commit c4274d1d14

@ -1,18 +1,30 @@
import os
import subprocess
import tempfile
from os import path
import logging
log = logging.getLogger(__name__)
from os import path
from sys import platform
log = logging.getLogger(__name__)
def envUpdate():
if path.exists(".env.template"):
envTemplate = subprocess.check_output(
"awk -F '=' 'NF {print $1}' .env.template | grep --regexp=^[a-zA-Z]", # noqa
shell=True,
)
if platform == "win32" or platform == "cygwin":
#envTemplate = subprocess.run(
# [r'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe',
# r'.\envUpdateWin.ps1'],
# stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
# shell=True
#)
print("Updating is not yet supported on Windows.")
return
elif platform == "darwin" or platform == "linux":
envTemplate = subprocess.check_output(
"awk -F '=' 'NF {print $1}' .env.template | grep --regexp=^[a-zA-Z]",
shell=True,
)
return
tempEnv = tempfile.TemporaryFile()
tempEnv.write(envTemplate)
tempEnv.seek(0)

@ -0,0 +1,2 @@
$envVars = Get-Content '.\.env'
$envVars -split "="
Loading…
Cancel
Save