[Pythonmac-SIG] SciPy install on Tiger with Python 2.4.1 framework
Chris Barker
Chris.Barker at noaa.gov
Thu Aug 11 19:26:08 CEST 2005
Bob Ippolito wrote:
> On Aug 11, 2005, at 6:15 AM, Samuel M. Smith wrote:
>>if sys.platform=='darwin':
>> if os.path.realpath(sys.executable).startswith('/System'):
>> # This is when Python is from Apple framework
>> opt.extend(["-Wl,-framework","-Wl,Python"])
>> #else we are running in Fink python.
>> opt.extend(["-lcc_dynamic","-bundle"])
>>else:
>> opt.append("-shared")
>>
>>Which looked like to me that someone had already accounted for the
>>framework build so I didn't make any changes
>>to setup.py
>
> Well, they tried to, but they did it wrong. It should be using a
> more robust way for detecting a framework Python. Something like
> 'Python.framework' in os.path.realpath(sys.executable)
Bob's exactly right (as usual) and I just feel the need to rant a little:
This is really lame coding, and it's a pattern I see a lot:
if ONE_WAY_TO_CHECK_FOR_ONE_THING:
do this
else:
we MUST be doing what I have on my system!
lame, and bug prone.
At the very least, they could have done something like:
if sys.platform=='darwin':
if os.path.realpath(sys.executable).startswith('/System'):
# This is when Python is from Apple framework
opt.extend(["-Wl,-framework","-Wl,Python"])
elif (Do something to actually check for fink):
opt.extend(["-lcc_dynamic","-bundle"])
else:
raise Exception("You seem to have a python I haven't been configured for")
else:
opt.append("-shared")
Would that be so hard? If they had done that, at least you would have
gotten a clear message about what was wrong.
Checking for fink could be a simple as:
os.path.realpath(sys.executable).startswith('/sw'):
That's not all that robust either, but it's a start.
<\rant>
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the Pythonmac-SIG
mailing list