[MacPorts] #13777: py25-numpy correction for Darwin 9 and Python Framework

MacPorts trac at macosforge.org
Wed Jan 2 08:08:59 PST 2008


#13777: py25-numpy correction for Darwin 9 and Python Framework
------------------------------+---------------------------------------------
  Reporter:  mdickens at nd.edu  |       Owner:  ram at macports.org               
      Type:  defect           |      Status:  assigned                       
  Priority:  Normal           |   Milestone:  Port Bugs                      
 Component:  ports            |     Version:  1.6.0                          
Resolution:                   |    Keywords:  py25-numpy, Framework, Darwin 9
------------------------------+---------------------------------------------
Comment (by mdickens at nd.edu):

 I don't have the exact text in front of me (in 10.4 right now), but the
 gist of the backtrace is:

 {{{
 import md5
 > from hashlib import md5
 >> tries to import _hashlib, but fails with
 >>> except: import _md5
 }}}

 This last command fails with an error that _md5 module cannot be found;
 this is not a "try:", but just a direct import.

 To explain why this happens, just a bit; I don't know why these scripts
 work on Darwin 8 and not 9, except that the PYTHONPATH must be set
 correctly on the former but not the latter:

 In python25's "setup.py" script (lines 570:587), if openssl version is >
 0x00907000, then the _hashlib shared library will be built (if desired).
 If openssl version is <= 0x00907000, then the _md5 shared library will be
 built.  As MacPorts has installed openssl "0.9.8g_0", hashlib is selected
 and md5 will not even be installed.  The patch-setup.py for MacPorts
 Portfile disables the compilation of hashlib, but this is installed as a
 requisite for py25-numpy as py25-hashlib.  By default (of the python25
 group script), all of the py25-YYY ports will be installed into
 {{{${prefix}/lib/python25/site-packages}}} .

 The non-framework install of Python populates {{{${prefix}/lib/python25}}}
 and related sub-directories with the standard python scripts (text,
 compiled, and shared libraries).  Under this version of Python, the
 PYTHONPATH will by default include {{{${prefix}/lib/python25/site-
 packages}}}, and thus adding this directory to the PYTHONPATH environment
 will not hurt but also won't change anything.

 The framework install of Python populates
 {{{${prefix}/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5}}}
 and related sub-directories with the standard python scripts (text,
 compiled, and shared libraries).  Under this version of Python, the
 PYTHONPATH will by default include
 {{{${prefix}/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
 /site-packages}}}, but ''not'' {{{${prefix}/lib/python25/site-packages}}},
 and thus adding this directory to the PYTHONPATH environment is required
 to access any packages installed by MacPorts.  The .py files for hashlib
 and such will be installed in
 {{{${prefix}/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5}}},
 while the shared library will be in {{{${prefix}/lib/python25/site-
 packages}}}.  Thus the need for setting the PYTHONPATH, both internal to
 MacPorts Portfiles as well as in the user's environment (which, of course,
 is up to the user).

 Another possible solution would be to modify the python25 group settings
 to install  py25-YYY packages into
 {{{${prefix}/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5}}}
 for the framework, and {{{${prefix}/lib/python25/site-packages}}} for the
 non-framework version ... I haven't looked into this, but it should be
 possible.

-- 
Ticket URL: <http://trac.macosforge.org/projects/macports/ticket/13777#comment:3>
MacPorts </projects/macports>
Ports system for Mac OS


More information about the macports-tickets mailing list