On 04/01/2013 22:05, Valerio Aimale wrote:
~suv, thanks for the comments.
I've uploaded Inkscape-0.48.4-Lion-x86_64.dmg to
<snip>
This is compiled from the 0.48.4 tarball with my modifications, launches with ScriptExec; it has no aspell dictionaries but -en.
Some comments about the bundled Python modules (Note: I can't test run the app myself):
1) Python modules with dynamically linked shared libraries
The launcher script 'Resources/bin/inkscape' sets these env variables:
# Put /usr/bin at beginning of path so we make sure we use Apple's python # over one that may be installed be Macports, Fink or some other means. export PATH="/usr/bin:$PATH"
# On Snow Leopard, use the 32-bit version of python from Universal build. # This is because our bundled i386 python libraries are 32-bit only. export VERSIONER_PYTHON_VERSION=2.7 export VERSIONER_PYTHON_PREFER_32_BIT=no
# Setup PYTHONPATH to use python modules shipped with Inkscape export PYTHONPATH="$TOP/python/site-packages" # NB: we are only preprending some stuff to the default python path so if the directory does not exist it should not harm the rest
# No longer required if path rewriting has been conducted. # export DYLD_LIBRARY_PATH="$TOP/lib"
combined with this:
$ otool -L Resources/python/site-packages/lxml/etree.so Resources/python/site-packages/lxml/etree.so: /opt/local/macports-with-a-very-looooooooooooooooooooooooooong-name/lib/libxslt.1.dylib (compatibility version 3.0.0, current version 3.27.0) /opt/local/macports-with-a-very-looooooooooooooooooooooooooong-name/lib/libexslt.0.dylib (compatibility version 9.0.0, current version 9.16.0) /opt/local/macports-with-a-very-looooooooooooooooooooooooooong-name/lib/libxml2.2.dylib (compatibility version 11.0.0, current version 11.0.0) /opt/local/macports-with-a-very-looooooooooooooooooooooooooong-name/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.7) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0) $
is (AFAIU) unlikely to work outside of your system, or as soon as that MacPorts tree no longer exists under the current path.
Inkscape spawns the first 'python' found in $PATH (which is /usr/bin/python), $DYLD_LIBRARY_PATH is not set (intentionally, consider it "evil" ;-) ), and the python process is unlikely to find the linked libraries (mainly libxslt, libexslt) installed into that specific prefix, and fail to properly import modules like lxml.
Ever since Inkscape.app got rid of depending on $DYLD_LIBRARY_PATH to find & load the bundled libs, included python modules with binary components need to be built statically linked against the system python version (unless alternatively a minimal functional (relocatable) python installation is included in the app bundle). At least this was the conclusion from bug #482993 [1].
Last fall, when I had tried to revive the X11-based packaging scripts on Lion, I wrote a small script to locally compile & install the lxml module for the system python version (2.7) with static dependencies into the 'packaging/macosx/Resources' folder (to have it automatically be added to the bundle when running osx-app.sh (called by osx-build.sh)). http://bazaar.launchpad.net/~suv-lp/+junk/inkscape-osxapp-stacked/view/head:/packaging/macosx/osx-lxml.sh IIRC extensions executed with the resulting Inkscape.app worked as expected (using the system python 2.7 in 64bit mode) even after having removed / renamed the current MacPorts tree, the build and install directories for inkscape and lxml.
Please note: the script hasn't been updated since, wasn't thoroughly tested (i.e. is likely to contain errors), and never was in any way integrated into the existing sets of scripts (one needed to run first, manually, before creating the rest of the app bundle). Maybe you can make use of it nevertheless (the variables (lxml version) and paths will need some tweaking - at the time I had also experimented with simplifying/reorganizing the bundle structure slightly).
I'm also attaching a small python extension [2] which was useful to me to test which version of python is spawned by Inkscape.app (this version no longer depends on inkex.py and thus now works even if lxml cannot be found. It reports the paths of the python binary and other information about the environment as seen by the spawned python process).
2) Minimally required modules to be included
The python-based extensions shipping with Inkscape require all 'lxml', and some additionally import numpy. 'lxml' needs to be bundled with Inkscape.app, 'numpy' OTOH has been included by Apple for its system python versions since Snow Leopard, and does not need to be included in the app bundle anymore (this has been confirmed for Snow Leopard and Lion, and is likely to also apply to Mountain Lion).
3) Just in case...
The packaging scripts may try to download an (outdated) DMG with precompiled python modules from modevia.com: this file is no longer hosted there. I have uploaded a copy to my DropBox account for now: http://dl.dropbox.com/u/65084033/devel/macosx/Python-packages.dmg though this would only be of interest when creating app bundles which run on older versions of OS X (currently not the case).
Regards, V
[1] https://bugs.launchpad.net/inkscape/+bug/482993 https://bugs.launchpad.net/inkscape/+bug/482993/comments/6 https://bugs.launchpad.net/inkscape/+bug/482993/comments/59 [2] latest version also available here (py-info.{inx,py}): http://bazaar.launchpad.net/~suv-lp/+junk/inkscape-extensions/files/head:/debug/