Skip to content

Commit ffec49b

Browse files
authored
Merge pull request #93 from eduNEXT/lmm/virtualenv
[BD-6] Fix check of virtualenv for virtualenv<20.0.0
2 parents 56abd45 + 46d4a1e commit ffec49b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

codejail/jail_code.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ def is_configured(command):
6262

6363
# By default, look where our current Python is, and maybe there's a
6464
# python-sandbox alongside. Only do this if running in a virtualenv.
65-
real_prefix = getattr(sys, "real_prefix", None)
66-
base_prefix = getattr(sys, "base_prefix", sys.prefix)
67-
running_in_virtualenv = (base_prefix or real_prefix) != sys.prefix
65+
# The check for sys.real_prefix covers virtualenv
66+
# the equality of non-empty sys.base_prefix with sys.prefix covers venv
67+
running_in_virtualenv = (hasattr(sys, 'real_prefix') or
68+
(hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix))
69+
6870
if running_in_virtualenv:
6971
# On jenkins
7072
sandbox_user = os.getenv('CODEJAIL_TEST_USER')

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
setup(
66
name="codejail",
7-
version="3.0.0",
7+
version="3.0.1",
88
packages=['codejail'],
99
zip_safe=False,
1010
classifiers=[

0 commit comments

Comments
 (0)