Ronald Oussoren <ronaldousso...@mac.com> added the comment:

Again without diving deep I've constructed a test case that is probably 
relevant.  I've pasted the diff below because I'm not yet convinced that it is 
correct (in particular the value for "argv0". This would also require a second 
test case that does something similar for a venv when using a framework build 
(the test_venv_macos case seems to be for a regular install and not a framework 
install)

With this tests case I get a test failure that matches my observations:

test test_getpath failed -- Traceback (most recent call last):
  File "/Users/ronald/Projects/Forks/cpython/Lib/test/test_getpath.py", line 
444, in test_framework_python
    self.assertEqual(expected, actual)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: {'exe[273 chars]/9.8/bin/python9.8', 'base_prefix': 
'/Library/[381 chars]ad']} != {'exe[273 
chars]/9.8/Resources/Python.app/Contents/MacOS/Pytho[410 chars]ad']}
  {'base_exec_prefix': '/Library/Frameworks/Python.framework/Versions/9.8',
-  'base_executable': 
'/Library/Frameworks/Python.framework/Versions/9.8/bin/python9.8',
?                                                                        ^^^ ^  
   - ^

+  'base_executable': 
'/Library/Frameworks/Python.framework/Versions/9.8/Resources/Python.app/Contents/MacOS/Python',
?                                                                        
^^^^^^^^^ ^      ^^^^^^^^^^^^^^^^^^^^^^^^^

   'base_prefix': '/Library/Frameworks/Python.framework/Versions/9.8',
   'exec_prefix': '/Library/Frameworks/Python.framework/Versions/9.8',
   'executable': 
'/Library/Frameworks/Python.framework/Versions/9.8/bin/python9.8',
   'module_search_paths': 
['/Library/Frameworks/Python.framework/Versions/9.8/lib/python98.zip',
                           
'/Library/Frameworks/Python.framework/Versions/9.8/lib/python9.8',
                           
'/Library/Frameworks/Python.framework/Versions/9.8/lib/python9.8/lib-dynload'],
   'module_search_paths_set': 1,
   'prefix': '/Library/Frameworks/Python.framework/Versions/9.8'}

test_getpath failed (1 failure)





The inline diff (and as mentioned before, I'm not sure if the value for "argv0" 
is correct):

%  git diff ../Lib/test/test_getpath.py                                         
                                                                            
(main)cpython
diff --git a/Lib/test/test_getpath.py b/Lib/test/test_getpath.py
index 3fb1b28003..69b469f179 100644
--- a/Lib/test/test_getpath.py
+++ b/Lib/test/test_getpath.py
@@ -414,6 +414,36 @@ def test_custom_platlibdir_posix(self):
         actual = getpath(ns, expected)
         self.assertEqual(expected, actual)
 
+    def test_framework_python(self):
+        """ Test framework layout on macOS """
+        ns = MockPosixNamespace(
+            os_name="darwin",
+            
argv0="/Library/Frameworks/Python.framework/Versions/9.8/Resources/Python.app/Contents/MacOS/Python",
+            PREFIX="/Library/Frameworks/Python.framework/Versions/9.8",
+            
ENV___PYVENV_LAUNCHER__="/Library/Frameworks/Python.framework/Versions/9.8/bin/python9.8",
+            
real_executable="/Library/Frameworks/Python.framework/Versions/9.8/Resources/Python.app/Contents/MacOS/Python",
+        )
+        
ns.add_known_xfile("/Library/Frameworks/Python.framework/Versions/9.8/Resources/Python.app/Contents/MacOS/Python")
+        
ns.add_known_xfile("/Library/Frameworks/Python.framework/Versions/9.8/bin/python9.8")
+        
ns.add_known_xfile("/Library/Frameworks/Python.framework/Versions/9.8/lib/python9.8/lib-dynload")
+        expected = dict(
+            
executable="/Library/Frameworks/Python.framework/Versions/9.8/bin/python9.8",
+            prefix="/Library/Frameworks/Python.framework/Versions/9.8",
+            exec_prefix="/Library/Frameworks/Python.framework/Versions/9.8",
+            
base_executable="/Library/Frameworks/Python.framework/Versions/9.8/bin/python9.8",
+            base_prefix="/Library/Frameworks/Python.framework/Versions/9.8",
+            
base_exec_prefix="/Library/Frameworks/Python.framework/Versions/9.8",
+            module_search_paths_set=1,
+            module_search_paths=[
+                
"/Library/Frameworks/Python.framework/Versions/9.8/lib/python98.zip",
+                
"/Library/Frameworks/Python.framework/Versions/9.8/lib/python9.8",
+                
"/Library/Frameworks/Python.framework/Versions/9.8/lib/python9.8/lib-dynload",
+            ],
+        )
+        actual = getpath(ns, expected)
+        self.assertEqual(expected, actual)
+
+


I may work on a PR later this week, but can't promise anything. My energy level 
is fairly low at the moment (for various reasons).

BTW. The code in getpath.py, and tests, also don't seem to handle different 
values for PYTHONFRAMEWORK, I sometimes use that to have a debug framework 
install next to a regular install.  I'll file a separate bug for that when I 
get around to testing this.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46890>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to