Hi,

since our python installation is located on a symlink'ed directory,
our variables "sys.exec_prefix" and "sys.executable" can have different
paths. Therefore, the respective test in build_ext.py fails (line 202)
and a wrong
library directory is obtained.

To fix this issue, I have attached a patch that uses "os.path.samefile"
instead,
to see whether two files are identical irrespective of its path.


Greetings

Sven Schrader



ps: please CC answers to me, I'm not on the list :-)
pps: I hope the attachment isn't inline...
Fixed path comparison in cases where symlinks to python executables are used.

Signed-off-by: Sven Schrader <sven.schra...@gmail.com>
Signed-off-by: Sven Rebhan <odinsho...@googlemail.com>
Signed-off-by: Jochen Eppler <jo...@gmx.net>

--- distutils/command/build_ext.py	2009-05-20 14:02:07.039240200 +0200
+++ distutils/command/build_ext.py.new	2009-05-20 14:06:55.491335213 +0200
@@ -186,7 +186,7 @@
         # for extensions under Cygwin and AtheOS Python's library directory must be
         # appended to library_dirs
         if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos':
-            if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
+            if os.path.samefile(os.path.join(sys.exec_prefix, "bin"), os.path.dirname(sys.executable)):
                 # building third party extensions
                 self.library_dirs.append(os.path.join(sys.prefix, "lib",
                                                       "python" + get_python_version(),
@@ -199,7 +199,7 @@
         # Python's library directory must be appended to library_dirs
         if (sys.platform.startswith('linux') or sys.platform.startswith('gnu')) \
                 and sysconfig.get_config_var('Py_ENABLE_SHARED'):
-            if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
+            if os.path.samefile(os.path.join(sys.exec_prefix, "bin"), os.path.dirname(sys.executable)):
                 # building third party extensions
                 self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
             else:
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to