Replacing a variant with many dependencies

Freek Dijkstra software at macfreek.nl
Mon Mar 19 06:08:05 PDT 2012


Freek Dijkstra wrote:

> I like to change a variant of a port with many dependencies.
> 
> In my case, change "python27" to "python27 +ucs4"
> 
> Unfortunately, a simple `port install python27 +ucs4` fails.
> (The destroot step fails while building Python.app while importing
> pyexpat with "Symbol not found: _PyUnicodeUCS2_Decode", see below)

FYI, I used a workaround to fix this. Let me report here in case someone
encounters this issue and is looking for a solution.

> I'm not sure if this a regular bug, or caused by the fact that I still
> have another Python variant installed.

I was close. It was caused by some files installed from py27-xml

Hence,

 sudo port upgrade --enforce-variants python27 +ucs4

did not work.

The destroot phase did compile some stuff from .py to .pyc (or .pyo?).
It seemed that the ./scripts/BuildApplet.py script did include some of
the existing packages. This failed for py27-xml because that contained C
code that used the non-wide (ucs2) functions:

site-packages/_xmlplus/parsers/expat.py:

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

I had a small issue where I removed the .py file, but left the
pre-compiled .pyo file (which of course had the same problem).

In the end, I simply made a list of all py27-* packages, removed them,
did the Python install, and then re-added these py27-* packages.

The only two minor side effects where two additional dependencies that I
had to uninstall (gnome-doc-utils +python27 andd gtk-doc). Perhaps
deactivating would have worked too, but this was just as quick. Also, I
forgot to keep track of variants during my first try and I could not
install py27-pyobjc (and hence py27-pyobjc py27-pyobjc-cocoa and
py27-matplotlib) because it did not work with wide (UCS4) Python builds.

That was it.

Regards,
Freek

>> ln -sf python2.7 "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python"
>> ln -sf pythonw2.7 "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/destroot/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw"
>> 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'



More information about the macports-users mailing list