classification
Title: python-32 not linked in /usr/local/bin in framework builds
Type: behavior Stage: resolved
Components: Macintosh Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: ned.deily, python-dev, ronaldoussoren, tloredo
Priority: normal Keywords:

Created on 2011-02-15 05:59 by tloredo, last changed 2011-05-28 15:11 by tloredo. This issue is now closed.

Files
File name Uploaded Description Edit
Python-2.7.1-patch.txt tloredo, 2011-02-19 06:35
Messages (8)
msg128578 - (view) Author: Tom Loredo (tloredo) Date: 2011-02-15 05:59
When building a universal framework Python-2.7.1 with homebrew on 10.6.6, python-32 (and its target, python2.7-32) are built and installed in the framework executable path, but they are not linked in /usr/local/bin.  msg101156 in Issue 8089 recognized this as a general MacPython problem in a 2.6.5 release candidate but deferred a fix for 2.6.6.  Apparently the fix was never implemented, or perhaps it was decided the link was not appropriate.  It seems to me it *is* appropriate (framework users don't currently have easy command-line access to python-32), but I defer to the experts!
msg128582 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-02-15 09:59
Taking a quick look at it, it appears that the Mac Makefile "installunixtools" target could/should create those links.  Note, this is not a problem for the standard OS X installers as Mac/BuildScript/build-installer.py (in buildPython) ensures that links are made in /usr/local/bin for all files in the framework bin directory at the end of the build.
msg128622 - (view) Author: Tom Loredo (tloredo) Date: 2011-02-15 22:15
I believe the main Makefile makes the Mac/Makefile.in installunixtools target automatically, and I don't see that it should do "the right thing" regarding linking a python-32.

I did the brew install again, logging the output, and adding an explicit "make frameworkinstallunixtools" (which I believe executes the Make makefile installunixtools target).  This is the log output showing that target is executed already by default, and that it is not linking python2.7-32:


cd Mac && make installunixtools DESTDIR=""
if [ ! -d "/usr/local/Cellar/python/2.7.1/bin" ]; then  \
		/usr/local/bin/ginstall -c -d -m 755 "/usr/local/Cellar/python/2.7.1/bin" ;\
	fi
for fn in python pythonw idle pydoc python-config smtpd.py 2to3 \
		  python2.7 pythonw2.7 idle2.7 \
		  pydoc2.7 python2.7-config smtpd2.7.py \
		  2to3-2.7 ;\
	do \
		ln -fs "/usr/local/Cellar/python/2.7.1/Frameworks/Python.framework/Versions/2.7/bin/${fn}" "/usr/local/Cellar/python/2.7.1/bin/${fn}" ;\
	done
==> make frameworkinstallunixtools
make frameworkinstallunixtools 
cd Mac && make installunixtools DESTDIR=""
if [ ! -d "/usr/local/Cellar/python/2.7.1/bin" ]; then  \
		/usr/local/bin/ginstall -c -d -m 755 "/usr/local/Cellar/python/2.7.1/bin" ;\
	fi
for fn in python pythonw idle pydoc python-config smtpd.py 2to3 \
		  python2.7 pythonw2.7 idle2.7 \
		  pydoc2.7 python2.7-config smtpd2.7.py \
		  2to3-2.7 ;\
	do \
		ln -fs "/usr/local/Cellar/python/2.7.1/Frameworks/Python.framework/Versions/2.7/bin/${fn}" "/usr/local/Cellar/python/2.7.1/bin/${fn}" ;\
	done

I don't see how the -32 versions would be linked by this part of the Makefile:


	for fn in python pythonw idle pydoc python-config smtpd.py 2to3 \
		  python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
		  pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py \
		  2to3-$(VERSION) ;\


Looking further at the logged output, the -32 versions appear to be extracted from a universal pythonw:


lipo -extract i386 -output /usr/local/Cellar/python/2.7.1/Frameworks/Python.framework/Versions/2.7/bin/python2.7-32 pythonw
lipo -extract i386 -output /usr/local/Cellar/python/2.7.1/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7-32 pythonw
ln -sf python2.7-32 "/usr/local/Cellar/python/2.7.1/Frameworks/Python.framework/Versions/2.7/bin/python-32"
ln -sf pythonw2.7-32 "/usr/local/Cellar/python/2.7.1/Frameworks/Python.framework/Versions/2.7/bin/pythonw-32"

I don't see how the unixtools targets will find these.
msg128829 - (view) Author: Tom Loredo (tloredo) Date: 2011-02-19 04:53
I believe this is a bug.

The -32 part of Mac/Makefile.in builds and links the -32 versions here:


ifneq ($(LIPO_32BIT_FLAGS),)
	lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/python$(VERSION)-32 pythonw
	lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32 pythonw
	ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python-32"
	ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw-32"
endif

For a framework build, the destinations are the framework location, and indeed the brew install does put them there.

Right after in Makefile.in is the unix tools part (which is run by default):

installunixtools:
	if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then  \
		$(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\
	fi
	for fn in python pythonw idle pydoc python-config smtpd.py 2to3 \
		  python$(VERSION) pythonw$(VERSION) idle$(VERSION) \
		  pydoc$(VERSION) python$(VERSION)-config smtpd$(VERSION).py \
		  2to3-$(VERSION) ;\
	do \
		ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
	done

I believe this needs an "ifneq ($(LIPO_32BIT_FLAGS),)" block that explicitly handles $(VERSION)-32, just like the pythonw section before it.
msg128832 - (view) Author: Tom Loredo (tloredo) Date: 2011-02-19 06:35
The attached patch does the trick.
msg137128 - (view) Author: Roundup Robot (python-dev) Date: 2011-05-28 13:05
New changeset a2f088cf7ced by Ned Deily in branch '2.7':
Issue #11217: For 64-bit/32-bit Mac OS X universal framework builds,
http://hg.python.org/cpython/rev/a2f088cf7ced

New changeset 7f2e3c466d57 by Ned Deily in branch '3.2':
Issue #11217: For 64-bit/32-bit Mac OS X universal framework builds,
http://hg.python.org/cpython/rev/7f2e3c466d57

New changeset 2936e8f12e4f by Ned Deily in branch 'default':
Issue #11217: For 64-bit/32-bit Mac OS X universal framework builds,
http://hg.python.org/cpython/rev/2936e8f12e4f
msg137129 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-05-28 13:30
Thanks for the suggested patch.  In addition to the "installunixtools" target, the "altinstallunixtools" target needed to be updated; it is used by default in the Python 3.x Makefiles.  The applied fix causes the following additional symlinks to be added to the --prefix bin directory for a 64-/32-bit framework install:

py27:  python2.7-32  pythonw2.7-32
       python-32     pythonw-32

py32:  python3.2-32  pythonw3.2-32
       python3-32    pythonw3-32 ["make frameworkinstallunixtools" only]
msg137137 - (view) Author: Tom Loredo (tloredo) Date: 2011-05-28 15:11
Thanks for handling this, Ned!  -Tom
History
Date User Action Args
2011-05-28 15:11:00tloredosetmessages: + msg137137
2011-05-28 13:30:58ned.deilysetstatus: open -> closed
resolution: fixed
messages: + msg137129

stage: needs patch -> resolved
2011-05-28 13:05:29python-devsetnosy: + python-dev
messages: + msg137128
2011-02-19 06:35:38tloredosetfiles: + Python-2.7.1-patch.txt
nosy: ronaldoussoren, ned.deily, tloredo
messages: + msg128832
2011-02-19 04:53:25tloredosetnosy: ronaldoussoren, ned.deily, tloredo
messages: + msg128829
2011-02-15 22:15:51tloredosetnosy: ronaldoussoren, ned.deily, tloredo
messages: + msg128622
2011-02-15 09:59:28ned.deilysetversions: + Python 3.2, Python 3.3
nosy: + ned.deily

messages: + msg128582

assignee: ronaldoussoren -> ned.deily
stage: needs patch
2011-02-15 05:59:09tloredocreate