I'm working on some extra cool and useful additions to PEP 370. It's going to make compilation and usage of custom libraries very easy. Sit back and watch the slide show. :) The site module has two new options. The --user-base option prints the path to the user base directory to stdout. $ ~/dev/python/trunk/python -m site --user-base /home/heimes/.local I install libxslt-1.1.19 into my ~/.local directory. libxslt-1.1.19$ ./configure --prefix `~/dev/python/trunk/python -m site --user-base` libxslt-1.1.19$ make libxslt-1.1.19$ make install ... test -z "/home/heimes/.local/lib" || mkdir -p -- "/home/heimes/.local/lib" /bin/bash ../libtool --mode=install /usr/bin/install -c 'libxslt.la' '/home/heimes/.local/lib/libxslt.la' /usr/bin/install -c .libs/libxslt.so.1.1.19 /home/heimes/.local/lib/libxslt.so.1.1.19 Now I compile lxml against the libraries and include directories in ~/.local. But first I have to add ~/.local/bin to PATH so lxml picks up the right xslt-config binary. $ export PATH=~/.local/bin:$PATH lxml-1.3.6$ ~/dev/python/trunk/python setup.py build_ext --user Building lxml version 1.3.6-8122 setupinfo.py:137: DeprecationWarning: os.popen3 is deprecated. Use the subprocess module. wf, rf, ef = os.popen3(cmd) /home/heimes/dev/python/trunk/Lib/distutils/dist.py:263: UserWarning: Unknown distribution option: 'zip_safe' warnings.warn(msg) running build_ext building 'lxml.etree' extension creating build creating build/temp.linux-i686-2.6-pydebug creating build/temp.linux-i686-2.6-pydebug/src creating build/temp.linux-i686-2.6-pydebug/src/lxml gcc -pthread -fno-strict-aliasing -g -Wall -Wstrict-prototypes -fPIC -I/home/heimes/.local/include -I/usr/include/libxml2 -I/home/heimes/dev/python/trunk/Include -I/home/heimes/dev/python/trunk -I/home/heimes/.local/include -c src/lxml/etree.c -o build/temp.linux-i686-2.6-pydebug/src/lxml/etree.o -w creating build/lib.linux-i686-2.6-pydebug creating build/lib.linux-i686-2.6-pydebug/lxml gcc -pthread -shared build/temp.linux-i686-2.6-pydebug/src/lxml/etree.o -L/home/heimes/.local/lib -L/home/heimes/.local/lib -Wl,-R/home/heimes/.local/lib -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-i686-2.6-pydebug/lxml/etree.so building 'lxml.objectify' extension gcc -pthread -fno-strict-aliasing -g -Wall -Wstrict-prototypes -fPIC -I/home/heimes/.local/include -I/usr/include/libxml2 -I/home/heimes/dev/python/trunk/Include -I/home/heimes/dev/python/trunk -I/home/heimes/.local/include -c src/lxml/objectify.c -o build/temp.linux-i686-2.6-pydebug/src/lxml/objectify.o -w gcc -pthread -shared build/temp.linux-i686-2.6-pydebug/src/lxml/objectify.o -L/home/heimes/.local/lib -L/home/heimes/.local/lib -Wl,-R/home/heimes/.local/lib -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-i686-2.6-pydebug/lxml/objectify.so building 'lxml.pyclasslookup' extension gcc -pthread -fno-strict-aliasing -g -Wall -Wstrict-prototypes -fPIC -I/home/heimes/.local/include -I/usr/include/libxml2 -I/home/heimes/dev/python/trunk/Include -I/home/heimes/dev/python/trunk -I/home/heimes/.local/include -c src/lxml/pyclasslookup.c -o build/temp.linux-i686-2.6-pydebug/src/lxml/pyclasslookup.o -w gcc -pthread -shared build/temp.linux-i686-2.6-pydebug/src/lxml/pyclasslookup.o -L/home/heimes/.local/lib -L/home/heimes/.local/lib -Wl,-R/home/heimes/.local/lib -lxslt -lexslt -lxml2 -lz -lm -o build/lib.linux-i686-2.6-pydebug/lxml/pyclasslookup.so lxml-1.3.6$ ~/dev/python/trunk/python setup.py install --user ... As you can see etree.so is going to load my local libxslt library instead of the system one. $ ldd /home/heimes/.local/lib/python2.6/site-packages/lxml/etree.so linux-gate.so.1 => (0xb7fc5000) libxslt.so.1 => /home/heimes/.local/lib/libxslt.so.1 (0xb7e89000) libexslt.so.0 => /home/heimes/.local/lib/libexslt.so.0 (0xb7e78000) libxml2.so.2 => /usr/lib/libxml2.so.2 (0xb7d3d000) libz.so.1 => /usr/lib/libz.so.1 (0xb7d28000) libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7d03000) libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7ceb000) libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7b9c000) libgcrypt.so.11 => /lib/libgcrypt.so.11 (0xb7b4e000) libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7b4a000) /lib/ld-linux.so.2 (0xb7fc6000) libgpg-error.so.0 => /lib/libgpg-error.so.0 (0xb7b46000) Comments? :) Christian
On Fri, May 9, 2008 at 12:05 AM, Christian Heimes <lists@cheimes.de> wrote:
I'm working on some extra cool and useful additions to PEP 370. It's going to make compilation and usage of custom libraries very easy. Sit back and watch the slide show. :)
The site module has two new options. The --user-base option prints the path to the user base directory to stdout.
What is the second option? And BTW, I wish we had this in 2.5 since I could finally install packages that can be used by both the OS X Python installation as well as my own build. =) This will be a handy feature once it is in a widely distributed version of Python. -Brett
Brett Cannon schrieb:
On Fri, May 9, 2008 at 12:05 AM, Christian Heimes <lists@cheimes.de> wrote:
I'm working on some extra cool and useful additions to PEP 370. It's going to make compilation and usage of custom libraries very easy. Sit back and watch the slide show. :)
The site module has two new options. The --user-base option prints the path to the user base directory to stdout.
What is the second option?
--user-site $ ~/dev/python/trunk/python -m site --help /home/heimes/dev/python/trunk/Lib/site.py [--user-base] [--user-site] Without arguments print some useful information With arguments print the value of USER_BASE and/or USER_SITE separated by ':'. Exit codes with --user-base or --user-site: 0 - user site directory is enabled 1 - user site diretory is disabled by user 2 - uses site directory is disabled by super user or for security reasons
2 - unknown error
On Fri, May 9, 2008 at 12:30 AM, Christian Heimes <lists@cheimes.de> wrote:
Brett Cannon schrieb:
On Fri, May 9, 2008 at 12:05 AM, Christian Heimes <lists@cheimes.de> wrote:
I'm working on some extra cool and useful additions to PEP 370. It's going to make compilation and usage of custom libraries very easy. Sit back and watch the slide show. :)
The site module has two new options. The --user-base option prints the path to the user base directory to stdout.
What is the second option?
--user-site
Ah, OK.
$ ~/dev/python/trunk/python -m site --help /home/heimes/dev/python/trunk/Lib/site.py [--user-base] [--user-site]
Without arguments print some useful information With arguments print the value of USER_BASE and/or USER_SITE separated by ':'.
Exit codes with --user-base or --user-site: 0 - user site directory is enabled 1 - user site diretory is disabled by user
Typo: missing a "c" in "directory".
2 - uses site directory is disabled by super user or for security reasons
2 - unknown error
Yeah, they should both be useful for various path-related stuff. -Brett
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On May 8, 2008, at 6:05 PM, Christian Heimes wrote:
I'm working on some extra cool and useful additions to PEP 370. It's going to make compilation and usage of custom libraries very easy. Sit back and watch the slide show. :)
Comments? :)
Christian, you get this week's Awesome Award. :) - -Barry -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iQCVAwUBSCQ/HnEjvBPtnXfVAQK7QgQAumf3wL8nQeH6CVC4hlaqjNQ330KSaVfj /o2bKusu77R+MYyYq/OV5k3q2/eo1XyPUDlE4+JXldvnhmjmx33zTv+5MDZLIWbN PPTfmYosHcXMh4CG6iqFqZxCoobhGUJNWuEt/X5bcOkmh/v4TPqCO0QYarV3cA69 jVQzSPgIce0= =x/tK -----END PGP SIGNATURE-----
participants (5)
-
Barry Warsaw
-
Brett Cannon
-
Christian Heimes
-
Trent Nelson
-
Trent Nelson