From 41ace3a9e53b52b4271554d7aedd88d533ee5f5e Mon Sep 17 00:00:00 2001 From: rejbasket <39080670+rejbasket@users.noreply.github.com> Date: Wed, 8 Dec 2021 22:18:41 +0100 Subject: add macOS and windows installer (#1352) --- lib/gui/electron.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) mode change 100644 => 100755 lib/gui/electron.py (limited to 'lib/gui/electron.py') diff --git a/lib/gui/electron.py b/lib/gui/electron.py old mode 100644 new mode 100755 index dcf03c6f..651080a9 --- a/lib/gui/electron.py +++ b/lib/gui/electron.py @@ -22,7 +22,7 @@ def open_url(url): electron_path = os.path.join(get_bundled_dir("electron"), "inkstitch-gui") if sys.platform == "darwin": - electron_path += ".app/Contents/MacOS/inkstitch-gui" + electron_path = os.path.join(sys._MEIPASS, "electron", "inkstitch-gui.app", "Contents", "MacOS", "inkstitch-gui") command = ["open", "-W", "-a", electron_path, "--args", url] else: command = [electron_path, url] @@ -32,5 +32,18 @@ def open_url(url): cwd = get_bundled_dir("electron") # Any output on stdout will crash inkscape. - with open(os.devnull, 'w') as null: - return subprocess.Popen(command, cwd=cwd, stdout=null) + # In macos manual install the python env paths are incomplete + # Adding the yarn path to the env paths fixes this issue + if sys.platform == "darwin" and getattr(sys, 'frozen', None) is None: + mac_dev_env = os.environ.copy() + # these are paths installed by brew or macports + yarn_path = "/usr/local/bin:/opt/local/bin:" + if yarn_path in mac_dev_env["PATH"]: + pass + else: + mac_dev_env["PATH"] = yarn_path + mac_dev_env["PATH"] + with open(os.devnull, 'w') as null: + return subprocess.Popen(command, cwd=cwd, stdout=null, env=mac_dev_env) + else: + with open(os.devnull, 'w') as null: + return subprocess.Popen(command, cwd=cwd, stdout=null) -- cgit v1.2.3