Merge pull request #4924 from itsankitkp/fix-sys-path-for-venv

Ensure correct site packages are visible to rustpython
This commit is contained in:
Jeong, YunWon authored and GitHub committed 2023-04-23 15:28:19 +09:00
commit cf465bdd81
4 files changed
+16 -9

No files matched your search

+5
View File
@@ -308,6 +308,11 @@ jobs:
run: |
target/release/rustpython -m ensurepip
target/release/rustpython -c "import pip"
- if: runner.os != 'Windows'
name: Check if pip inside venv is functional
run: |
target/release/rustpython -m venv testvenv
testvenv/bin/rustpython -m pip install wheel
- name: Check whats_left is not broken
run: python -I whats_left.py
Vendored
+4 -2
View File
@@ -275,7 +275,8 @@ def _getuserbase():
if os.name == "nt":
base = os.environ.get("APPDATA") or "~"
return joinuser(base, "Python")
# XXX: RUSTPYTHON; please keep this change for site-packages
return joinuser(base, "RustPython")
if sys.platform == "darwin" and sys._framework:
return joinuser("~", "Library", sys._framework,
@@ -368,7 +369,8 @@ def getsitepackages(prefixes=None):
for libdir in libdirs:
path = os.path.join(prefix, libdir,
"python%d.%d" % sys.version_info[:2],
# XXX: RUSTPYTHON; please keep this change for site-packages
"rustpython%d.%d" % sys.version_info[:2],
"site-packages")
sitepackages.append(path)
else:
+3 -5
View File
@@ -1,3 +1,5 @@
# XXX: RUSTPYTHON; Trick to make sysconfig work as RustPython
exec(r'''
"""Access to Python's configuration information."""
import os
@@ -851,10 +853,6 @@ def _main():
print()
_print_dict('Variables', get_config_vars())
# XXX RUSTPYTHON: replace python with rustpython in all these paths
for group in _INSTALL_SCHEMES.values():
for key in group.keys():
group[key] = group[key].replace("Python", "RustPython").replace("python", "rustpython")
if __name__ == '__main__':
_main()
'''.replace("Python", "RustPython").replace("/python", "/rustpython"))
+4 -2
View File
@@ -288,13 +288,15 @@ class HelperFunctionsTests(unittest.TestCase):
if sys.platlibdir != "lib":
self.assertEqual(len(dirs), 2)
wanted = os.path.join('xoxo', sys.platlibdir,
'python%d.%d' % sys.version_info[:2],
# XXX: RUSTPYTHON
'rustpython%d.%d' % sys.version_info[:2],
'site-packages')
self.assertEqual(dirs[0], wanted)
else:
self.assertEqual(len(dirs), 1)
wanted = os.path.join('xoxo', 'lib',
'python%d.%d' % sys.version_info[:2],
# XXX: RUSTPYTHON
'rustpython%d.%d' % sys.version_info[:2],
'site-packages')
self.assertEqual(dirs[-1], wanted)
else: