Skip to content

Commit

Permalink
Hints: Enhanced tracing of standalone binaries
Browse files Browse the repository at this point in the history
* We consider the binary directory as PYTHONPATH too,
  so outputs will be more similar.

* Also more robust comparison and modification of paths
  which ought to be useful for Windows.
  • Loading branch information
kayhayen committed Feb 20, 2020
1 parent b965838 commit 0485c5a
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,24 @@ def _normalizePath(path):

best = None

for path_entry in sys.path:
if path.startswith(path_entry):
paths = list(sys.path)

# Nuitka standalone mode.
try:
paths.append(__nuitka_binary_dir)
paths.append(os.getcwd())
except NameError:
pass

for path_entry in paths:
path_entry = os.path.normcase(path_entry)

if os.path.normcase(path).startswith(path_entry):
if best is None or len(path_entry) > len(best):
best = path_entry

if best is not None:
path = path.replace(best, "$PYTHONPATH")
path = "$PYTHONPATH" + path[len(best) :]

return path

Expand Down

0 comments on commit 0485c5a

Please sign in to comment.