Projects
New Ticket     Wiki     Browse Source     Timeline     Roadmap     Bug Reports     Search

Ticket #13777 (closed defect: invalid)

Opened 11 months ago

Last modified 11 months ago

py25-numpy correction for Darwin 9 and Python Framework

Reported by: mdickens@… Owned by: ram@…
Priority: Normal Milestone: Port Bugs
Component: ports Version: 1.6.0
Keywords: py25-numpy, Framework, Darwin 9 Cc: mdickens@…
Port:

Description

If, somehow, one uses a Framework install of Python, then the PYTHONPATH isn't correct for the MacPorts site-packages ( /opt/local/lib/python2.5/site-packages/ ) required to compile numpy. This patch adds the correct PYTHONPATH to the build and destroot environment.

This will not be an issue if using the MacPorts non-Framework install of Python 2.5. But there are folks who need the Framework version (see, e.g. ticket:12817), and thus this correction is needed.

Attachments

patch-Portfile.diff (0.5 KB) - added by mdickens@… 11 months ago.
Patch for the py25-numpy portfile, allows for installation in Darwin 9 when using Python Framework

Change History

Changed 11 months ago by mdickens@…

Patch for the py25-numpy portfile, allows for installation in Darwin 9 when using Python Framework

Changed 11 months ago by ram@…

  • owner changed from macports-tickets@… to ram@…
  • status changed from new to assigned

Changed 11 months ago by ram@…

what is the error if this is not present for a framework python build?

Changed 11 months ago by mdickens@…

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.

Changed 11 months ago by ram@…

This issue has been brought up in #11267, one of the many tickets tracking the request for python25 to be a framework build...

Changed 11 months ago by mdickens@…

This ticket is not a request for a Python framework build, though that would be nice; yes I know about ticket #11267 and others ... I'm the submitter of the tarball on ticket #11267 that, at least for me, works for both framework and non-framework Python installs on both Darwin 8 and 9. I, for one, need framework Python install, and hope that whatever changes are needed to get that Port functional are made ASAP.

This ticket is explaining why py25-numpy doesn't install correctly when using a Python framework under Darwin 9, and a patch to correct the issue. The changes in this patch do not affect Darwin 8 or prior, and won't change anything on Darwin 9 with a non-framework Python. All this patch does is, under Darwin 9, add ${prefix}/lib/python25/site-packages to the PYTHONPATH for both build and destroot.

Maybe I'm jumping the gun here, since maybe the eventual Python framework install's PYTHONPATH will be correct without any further additions. We won't know until a framework install is available.

Changed 11 months ago by ram@…

Yes I know, I was just commenting that someone else has reported this very same issue, i.e. _md5 etc... not being found, in one of the comments for #11267

Changed 11 months ago by ram@…

I take it from http://trac.macosforge.org/projects/macports/ticket/11267#comment:17 that this change is no longer needed for the framework build of python25?

Changed 11 months ago by mdickens@…

Yes, that is correct. I was going to enter such a comment later tonight on this ticket, when I had more time; you beat me to it! Please go ahead and close out this ticket. Thanks for keeping on top of things!

Changed 11 months ago by ram@…

  • status changed from assigned to closed
  • resolution set to invalid

closing as invalid as this problem is now fixed in the Framework build patch

Note: See TracTickets for help on using tickets.