mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-30 00:22:10 -04:00
Keep Cookbook POSIX paths stable on Windows hosts
This commit is contained in:
committed by
GitHub
parent
4bbf82c2ab
commit
42380a8693
@@ -3,6 +3,7 @@ Extracted from cookbook_routes.py; the routes module imports the symbols it need
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import posixpath
|
||||||
import re
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
|
|
||||||
@@ -112,6 +113,12 @@ def _local_tooling_path_export(executable: str) -> str:
|
|||||||
macOS, where the `pip --user` self-heal also misses (`pip` isn't a command,
|
macOS, where the `pip --user` self-heal also misses (`pip` isn't a command,
|
||||||
only `pip3`/`python3 -m pip`). Local runs only; meaningless over SSH.
|
only `pip3`/`python3 -m pip`). Local runs only; meaningless over SSH.
|
||||||
"""
|
"""
|
||||||
|
# This builds a bash snippet, so an explicit POSIX absolute path should keep
|
||||||
|
# POSIX semantics even when the app/tests run on Windows. Otherwise
|
||||||
|
# os.path.abspath("/opt/...") would incorrectly turn it into "D:\\opt\\...".
|
||||||
|
if executable.startswith("/"):
|
||||||
|
bin_dir = posixpath.dirname(executable)
|
||||||
|
else:
|
||||||
bin_dir = os.path.dirname(os.path.abspath(executable))
|
bin_dir = os.path.dirname(os.path.abspath(executable))
|
||||||
# Escape for a double-quoted context: $PATH must still expand, but spaces
|
# Escape for a double-quoted context: $PATH must still expand, but spaces
|
||||||
# and shell metacharacters in the path must be preserved literally.
|
# and shell metacharacters in the path must be preserved literally.
|
||||||
|
|||||||
Reference in New Issue
Block a user