[pypy-commit] pypy default: use DYLD_LIBRARY_PATH on darwin

bdkearns noreply at buildbot.pypy.org
Sat Feb 9 11:52:10 CET 2013


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r61003:c729af9671e6
Date: 2013-02-09 02:51 -0800
http://bitbucket.org/pypy/pypy/changeset/c729af9671e6/

Log:	use DYLD_LIBRARY_PATH on darwin

diff --git a/rpython/translator/c/gcc/test/test_asmgcroot.py b/rpython/translator/c/gcc/test/test_asmgcroot.py
--- a/rpython/translator/c/gcc/test/test_asmgcroot.py
+++ b/rpython/translator/c/gcc/test/test_asmgcroot.py
@@ -73,7 +73,11 @@
             else:
                 redirect = ''
             if config.translation.shared and os.name == 'posix':
-                env = 'LD_LIBRARY_PATH="%s" ' % (exe_name.dirpath(),)
+                library_path = exe_name.dirpath()
+                if sys.platform == 'darwin':
+                    env = 'DYLD_LIBRARY_PATH="%s" ' % library_path
+                else:
+                    env = 'LD_LIBRARY_PATH="%s" ' % library_path
             else:
                 env = ''
             cwd = os.getcwd()
diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py
--- a/rpython/translator/c/test/test_standalone.py
+++ b/rpython/translator/c/test/test_standalone.py
@@ -687,8 +687,12 @@
         t, cbuilder = self.compile(entry_point, shared=True)
         assert cbuilder.shared_library_name is not None
         assert cbuilder.shared_library_name != cbuilder.executable_name
-        monkeypatch.setenv('LD_LIBRARY_PATH',
-                           cbuilder.shared_library_name.dirpath())
+        if os.name == 'posix':
+            library_path = cbuilder.shared_library_name.dirpath()
+            if sys.platform == 'darwin':
+                monkeypatch.setenv('DYLD_LIBRARY_PATH', library_path)
+            else:
+                monkeypatch.setenv('LD_LIBRARY_PATH', library_path)
         out, err = cbuilder.cmdexec("a b")
         assert out == "3"
 
diff --git a/rpython/translator/platform/__init__.py b/rpython/translator/platform/__init__.py
--- a/rpython/translator/platform/__init__.py
+++ b/rpython/translator/platform/__init__.py
@@ -89,8 +89,11 @@
 
         # Set LD_LIBRARY_PATH on posix platforms
         if os.name == 'posix' and compilation_info is not None:
-            env['LD_LIBRARY_PATH'] = ':'.join(
-                [str(i) for i in compilation_info.library_dirs])
+            library_path = ':'.join([str(i) for i in compilation_info.library_dirs])
+            if sys.platform == 'darwin':
+                env['DYLD_LIBRARY_PATH'] = library_path
+            else:
+                env['LD_LIBRARY_PATH'] = library_path
 
         returncode, stdout, stderr = _run_subprocess(str(executable), args,
                                                      env)


More information about the pypy-commit mailing list