[MacPorts] #32090: python27 +universal: destroot fails if py27-xml is installed non-universal
MacPorts
noreply at macports.org
Mon Mar 19 12:04:04 PDT 2012
#32090: python27 +universal: destroot fails if py27-xml is installed non-universal
----------------------------------+-----------------------------------------
Reporter: cdiehl@… | Owner: jwa@…
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.0.3
Keywords: | Port: python27 py27-xml
----------------------------------+-----------------------------------------
Comment(by software@…):
FYI,
I encountered a somewhat similar issue. While the problem is slightly
different, the resolution posted by vloodo above works just as well in
this case.
In my case, I wanted to replace `python27` with `python27 +ucs4`. I had
py27-xml installed at the time I was doing the replace. This lead to the
following error during the destroot phase:
{{{
DYLD_FRAMEWORK_PATH=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/Python-2.7.2:
../python.exe ./scripts/BuildApplet.py \
--destroot
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/destroot"
\
--python=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
\
--output
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/destroot/Applications/MacPorts/Python
2.7/Build Applet.app" \
./scripts/BuildApplet.py
Traceback (most recent call last):
File "./scripts/BuildApplet.py", line 156, in <module>
main()
File "./scripts/BuildApplet.py", line 36, in main
buildapplet()
File "./scripts/BuildApplet.py", line 123, in buildapplet
progress=verbose, destroot=destroot)
File
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/Python-2.7.2/Lib
/plat-mac/buildtools.py", line 122, in process
copy_codefragment, raw, others, filename, destroot)
File
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/Python-2.7.2/Lib
/plat-mac/buildtools.py", line 151, in process_common
is_update, raw, others, filename, destroot)
File
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/Python-2.7.2/Lib
/plat-mac/buildtools.py", line 332, in process_common_macho
builder.plist = plistlib.Plist.fromFile(plistname)
File
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/Python-2.7.2/Lib/plistlib.py",
line 345, in fromFile
rootObject = readPlist(pathOrFile)
File
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/Python-2.7.2/Lib/plistlib.py",
line 78, in readPlist
rootObject = p.parse(pathOrFile)
File
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/Python-2.7.2/Lib/plistlib.py",
line 401, in parse
from xml.parsers.expat import ParserCreate
File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/site-packages/_xmlplus/parsers/expat.py", line 4, in <module>
from pyexpat import *
ImportError:
dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/site-packages/_xmlplus/parsers/pyexpat.so, 2): Symbol not found:
_PyUnicodeUCS2_Decode
Referenced from:
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/site-packages/_xmlplus/parsers/pyexpat.so
Expected in: flat namespace
in
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/site-packages/_xmlplus/parsers/pyexpat.so
make[1]: *** [install_BuildApplet] Error 1
make[1]: Leaving directory
`/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/Python-2.7.2/Mac'
make: *** [frameworkinstallapps] Error 2
make: Leaving directory
`/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/Python-2.7.2'
}}}
In short, destroot is calling some script called ./scripts/BuildApplet.py
to compile .py to .pyc or .pyo files. (Building at the destroot phase is
indeed ugly; you can blame that on Python).
This script somehow imports site-packages, including py27-xml. py27-xml
apparently uses a pyexpat.so shared object which is compiled against
Python's C API. This fails if the C API is changes between Python builds.
In my case, it was looking for the _PyUnicodeUCS2_Decode symbol, but a
wide Pythone build (+ucs4) will not contain the UCS2 stuff, hence
pyexpat.so fails.
As for a solution -- it seems that making sure py27-xml is deactivated
during the destroot phase of Python27 solves the problem, exactly as
described by vloodo above:
Please let me know if I should file this as separate bug report.
--
Ticket URL: <https://trac.macports.org/ticket/32090#comment:11>
MacPorts <http://www.macports.org/>
Ports system for Mac OS
More information about the macports-tickets
mailing list