Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions venv_pack/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class VenvPackException(Exception):
LONG_SHEBANG_REGEX = (
br"^(#!/bin/sh[\n\r]*"
br"'''exec'(?:[ ]*)"
br"(/\\ |[^ \n\r\t]*)"
br"'?(/\\ |[^ \n\r\t]*)'?"
br"(.*)"
br"[\n\r]*' '''"
br")$")
Expand Down Expand Up @@ -616,7 +616,7 @@ def _rewrite_shebang(data, target, prefix):

shebang, executable, options = shebang_match.groups()

if executable.startswith(prefix):
if os.path.realpath(executable).startswith(os.path.realpath(prefix)):
# shebang points inside environment, rewrite
new_shebang = (b'#!%s'
if on_win else
Expand Down