Add OS check, PS script (unfinished)
Added a check for your operating system and a PowerShell script which is unfinished at the moment.
This commit is contained in:
1 parent
565a8dd58f
commit
c4274d1d14
2 files changed
+20
-6
No files matched your search
+18
-6
@@ -1,18 +1,30 @@
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
from os import path
|
||||
import logging
|
||||
|
||||
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 "="
|
||||
Reference in new issue
Block a user