mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-18 16:47:42 +01:00
Add windows build support from jf-accounts
This commit is contained in:
@@ -1,13 +1,28 @@
|
||||
import subprocess
|
||||
import shutil
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
def runcmd(cmd):
|
||||
if os.name == "nt":
|
||||
return subprocess.check_output(cmd, shell=True)
|
||||
proc = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
|
||||
return proc.communicate()
|
||||
|
||||
local_path = Path(__file__).resolve().parent
|
||||
node_bin = local_path.parent / 'node_modules' / '.bin'
|
||||
out = runcmd("npm bin")
|
||||
|
||||
try:
|
||||
node_bin = Path(out[0].decode('utf-8').rstrip())
|
||||
except:
|
||||
node_bin = Path(out.decode('utf-8').rstrip())
|
||||
|
||||
print(f"assuming npm bin directory \"{node_bin}\". Is this correct?")
|
||||
if input("[yY/nN]: ").lower() == "n":
|
||||
node_bin = local_path.parent / 'node_modules' / '.bin'
|
||||
print(f"this? \"{node_bin}\"")
|
||||
if input("[yY/nN]: ").lower() == "n":
|
||||
node_bin = input("input bin directory: ")
|
||||
|
||||
for mjml in [f for f in local_path.iterdir() if f.is_file() and 'mjml' in f.suffix]:
|
||||
print(f'Compiling {mjml.name}')
|
||||
|
||||
Reference in New Issue
Block a user