From ba6757ad11202bdcda5b421a512bf33abb300d8a Mon Sep 17 00:00:00 2001 From: Ankit Kumar Pandey Date: Sat, 22 Apr 2023 18:01:44 +0530 Subject: [PATCH 1/4] add CI for pip check inside venv --- .github/workflows/ci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2591b16a0..c901ada03 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 From d9c808ded8cad8bbab468f39d8460b2a97202aa3 Mon Sep 17 00:00:00 2001 From: Ankit Kumar Pandey Date: Sat, 22 Apr 2023 13:21:13 +0530 Subject: [PATCH 2/4] Fix site and test_site for rustpython --- Lib/site.py | 4 ++-- Lib/test/test_site.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/site.py b/Lib/site.py index 06c103333..b9eabb03c 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -275,7 +275,7 @@ def _getuserbase(): if os.name == "nt": base = os.environ.get("APPDATA") or "~" - return joinuser(base, "Python") + return joinuser(base, "RustPython") if sys.platform == "darwin" and sys._framework: return joinuser("~", "Library", sys._framework, @@ -368,7 +368,7 @@ def getsitepackages(prefixes=None): for libdir in libdirs: path = os.path.join(prefix, libdir, - "python%d.%d" % sys.version_info[:2], + "rustpython%d.%d" % sys.version_info[:2], "site-packages") sitepackages.append(path) else: diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index d8e046570..c3b1cac69 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -288,13 +288,13 @@ 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], + '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], + 'rustpython%d.%d' % sys.version_info[:2], 'site-packages') self.assertEqual(dirs[-1], wanted) else: From 09a1ce9b2b2648ebe12468dc32a0256c212322a1 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Sun, 23 Apr 2023 11:19:02 +0900 Subject: [PATCH 3/4] Add XXX: RUSTPYTHON --- Lib/site.py | 2 ++ Lib/test/test_site.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Lib/site.py b/Lib/site.py index b9eabb03c..6d5dca641 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -275,6 +275,7 @@ def _getuserbase(): if os.name == "nt": base = os.environ.get("APPDATA") or "~" + # XXX: RUSTPYTHON; please keep this change for site-packages return joinuser(base, "RustPython") if sys.platform == "darwin" and sys._framework: @@ -368,6 +369,7 @@ def getsitepackages(prefixes=None): for libdir in libdirs: path = os.path.join(prefix, libdir, + # XXX: RUSTPYTHON; please keep this change for site-packages "rustpython%d.%d" % sys.version_info[:2], "site-packages") sitepackages.append(path) diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index c3b1cac69..fb9aca659 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -288,12 +288,14 @@ class HelperFunctionsTests(unittest.TestCase): if sys.platlibdir != "lib": self.assertEqual(len(dirs), 2) wanted = os.path.join('xoxo', sys.platlibdir, + # 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', + # XXX: RUSTPYTHON 'rustpython%d.%d' % sys.version_info[:2], 'site-packages') self.assertEqual(dirs[-1], wanted) From aad1d848a69bce89240182e098936472d5f9531e Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Sun, 23 Apr 2023 11:14:19 +0900 Subject: [PATCH 4/4] Rewrite Python->RustPython on sysconfig.py Co-Authored-By: Ankit Kumar Pandey --- Lib/sysconfig.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index f14b138bb..9999d6bbd 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -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"))