Skip to content

Commit 9c77dcb

Browse files
committed
Merge pull request #2650 from getsentry/fix-path
Manually set our $PATH before executing uwsgi bin
1 parent 7f0a467 commit 9c77dcb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/sentry/services/http.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,14 @@ def run(self):
124124
# This has already been validated inside __init__
125125
os.environ['SENTRY_SKIP_BACKEND_VALIDATION'] = '1'
126126

127+
# Look up the bin directory where `sentry` exists, which should be
128+
# sys.argv[0], then inject that to the front of our PATH so we can reliably
129+
# find the `uwsgi` that's installed when inside virtualenv.
130+
# This is so the virtualenv doesn't need to be sourced in, which effectively
131+
# does exactly this.
132+
virtualenv_path = os.path.dirname(os.path.abspath(sys.argv[0]))
133+
current_path = os.environ.get('PATH', '')
134+
if virtualenv_path not in current_path:
135+
os.environ['PATH'] = '%s:%s' % (virtualenv_path, current_path)
136+
127137
os.execvp('uwsgi', ('uwsgi',))

0 commit comments

Comments
 (0)