diff options
author | Zach White <skullydazed@gmail.com> | 2021-08-29 16:46:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-29 16:46:36 -0700 |
commit | baa423004a870b5cb86f4d1197dcda5f8b390f49 (patch) | |
tree | eef5846efa97965008281dbdab9212cd84c81004 | |
parent | b705020dafd0aa7531d03cd8fa64260684a3fb79 (diff) | |
download | qmk_firmware-baa423004a870b5cb86f4d1197dcda5f8b390f49.tar.gz qmk_firmware-baa423004a870b5cb86f4d1197dcda5f8b390f49.zip |
ensure that the directory for sys.executable is in the user's path (#14229)
-rw-r--r-- | lib/python/qmk/cli/__init__.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/python/qmk/cli/__init__.py b/lib/python/qmk/cli/__init__.py index b22f1c0d2..f45e33240 100644 --- a/lib/python/qmk/cli/__init__.py +++ b/lib/python/qmk/cli/__init__.py | |||
@@ -181,8 +181,14 @@ if int(milc_version[0]) < 2 and int(milc_version[1]) < 4: | |||
181 | print(f'Your MILC library is too old! Please upgrade: python3 -m pip install -U -r {str(requirements)}') | 181 | print(f'Your MILC library is too old! Please upgrade: python3 -m pip install -U -r {str(requirements)}') |
182 | exit(127) | 182 | exit(127) |
183 | 183 | ||
184 | # Make sure we can run binaries in the same directory as our Python interpreter | ||
185 | python_dir = os.path.dirname(sys.executable) | ||
186 | |||
187 | if python_dir not in os.environ['PATH'].split(':'): | ||
188 | os.environ['PATH'] = ":".join((python_dir, os.environ['PATH'])) | ||
189 | |||
184 | # Check to make sure we have all our dependencies | 190 | # Check to make sure we have all our dependencies |
185 | msg_install = 'Please run `python3 -m pip install -r %s` to install required python dependencies.' | 191 | msg_install = f'Please run `{sys.executable} -m pip install -r %s` to install required python dependencies.' |
186 | args = sys.argv[1:] | 192 | args = sys.argv[1:] |
187 | while args and args[0][0] == '-': | 193 | while args and args[0][0] == '-': |
188 | del args[0] | 194 | del args[0] |