I've been aware that the distutils sig has been simmerring away, but
until recently it has not been directly relevant to what I do.
I like the look of the proposed api, but have one question. Will this
support an installed system that has multiple versions of the same
package installed simultaneously? If not, then this would seem to be a
significant limitation, especially when dependencies between packages
Assuming it does, then how will this be achieved? I am presently
managing this with a messy arrangement of symlinks. A package is
installed with its version number in it's name, and a separate
directory is created for an application with links from the
unversioned package name to the versioned one. Then I just set the
pythonpath to this directory.
A sample of what the directory looks like is shown below.
I'm sure there is a better solution that this, and I'm not sure that
this would work under windows anyway (does windows have symlinks?).
So, has this SIG considered such versioning issues yet?
Tim Docker timd(a)macquarie.com.au
Quantative Applications Division
qad16:qad $ ls -l lib/python/
drwxr-xr-x 2 mts mts 512 Nov 11 11:23 1.1
-r--r----- 1 root mts 45172 Sep 1 1998 cdrmodule_0_7_1.so
drwxr-xr-x 2 mts mts 512 Sep 1 1998 chart_1_1
drwxr-xr-x 3 mts mts 512 Sep 1 1998 Fnorb_0_7_1
dr-xr-x--- 3 mts mts 512 Nov 11 11:21 Fnorb_0_8
drwxr-xr-x 3 mts mts 1536 Mar 3 12:45 mts_1_1
dr-xr-x--- 7 mts mts 512 Nov 11 11:22 OpenGL_1_5_1
dr-xr-x--- 2 mts mts 1024 Nov 11 11:23 PIL_0_3
drwxr-xr-x 3 mts mts 512 Sep 1 1998 Pmw_0_7
dr-xr-x--- 2 mts mts 512 Nov 11 11:21 v3d_1_1
qad16:qad $ ls -l lib/python/1.1
lrwxrwxrwx 1 root other 29 Apr 10 10:43 _glumodule.so -> ../OpenGL_1_5_1/_glumodule.so
lrwxrwxrwx 1 root other 30 Apr 10 10:43 _glutmodule.so -> ../OpenGL_1_5_1/_glutmodule.so
lrwxrwxrwx 1 root other 22 Apr 10 10:43 _imaging.so -> ../PIL_0_3/_imaging.so
lrwxrwxrwx 1 root other 36 Apr 10 10:43 _opengl_nummodule.so -> ../OpenGL_1_5_1/_opengl_nummodule.so
lrwxrwxrwx 1 root other 27 Apr 10 10:43 _tkinter.so -> ../OpenGL_1_5_1/_tkinter.so
lrwxrwxrwx 1 mts mts 21 Apr 10 10:43 cdrmodule.so -> ../cdrmodule_0_7_1.so
lrwxrwxrwx 1 mts mts 12 Apr 10 10:43 chart -> ../chart_1_1
lrwxrwxrwx 1 root other 12 Apr 10 10:43 Fnorb -> ../Fnorb_0_8
lrwxrwxrwx 1 mts mts 12 Apr 10 10:43 mts -> ../mts_1_1
lrwxrwxrwx 1 root other 15 Apr 10 10:43 OpenGL -> ../OpenGL_1_5_1
lrwxrwxrwx 1 root other 33 Apr 10 10:43 opengltrmodule.so -> ../OpenGL_1_5_1/opengltrmodule.so
lrwxrwxrwx 1 root other 33 Apr 10 10:43 openglutil_num.so -> ../OpenGL_1_5_1/openglutil_num.so
lrwxrwxrwx 1 root other 10 Apr 10 10:43 PIL -> ../PIL_0_3
lrwxrwxrwx 1 mts mts 10 Apr 10 10:43 Pmw -> ../Pmw_0_7
lrwxrwxrwx 1 root other 10 Apr 10 10:43 v3d -> ../v3d_1_1
On Wed, April 9, 2008 10:05 pm, Greg Ewing <greg.ewing(a)canterbury.ac.nz>
> Message: 4
> Date: Thu, 10 Apr 2008 12:59:39 +1200
> From: Greg Ewing <greg.ewing(a)canterbury.ac.nz>
> Subject: Re: [Distutils] how to easily consume just the parts of eggs
> that are good for you
> To: distutils-sig(a)python.org
> Paul Moore wrote:
>> I believe that Mac OS X goes for an even simpler structure -
>> applications store *everything* in the one directory, so that
>> install/uninstall is simply a directory copy/remove.
> Yep, and thereby cuts the whole gordian knot, throws the
> pieces on the fire and burns them. :-)
> Package managers have always seemed to me to be an
> excessively complex solution to a problem that needn't
> have existed in the first place.
> I keep hoping that someday Linux will support something
> like MacOSX application bundles and frameworks, but I
> haven't seen any sign of it yet.
I think this discussion arises because the operating systems we are
dealing with are based on very different concepts.
Windows and Mac are fundamentally single user systems that have added
capabilities for multiple users and are intended to be used with
proprietary software. Those considerations lead to minimal dependencies
among packages (each proprietary provider needs to control its own
package, except for the OS), individual users serving as their own
sysadmins, and similar factors. Any dependencies in the proprietary
software are hidden from the user because the provider has compiled the
dependencies into the binary code they supply.
Unix/Linux are fundamentally multi-user systems with a distinct role for a
sysadmin. Linux and the BSD's are intended to be used with Free/Open
Source Software (FOSS), and Unix originated the Software Tools concept in
which individual, relatively simple, separately-developed tools are
combined to perform complex tasks. Both FOSS and the Software Tools
concept encourage dependencies.
The need for package managers arises out of the Unix FHS. If you look at
the FHS, it is clearly designed to simplify the job of the sysadmin in a
multi-user system that uses FOSS and Software Tools. For example,
deciding what to backup and how often to do it in a Unix/Linux system is
relatively easy for the sysadmin. All the installed software is in
certain top-level directories. All the config files are in /etc. All the
logs. caches, spools, web pages, process locks, and certain other data are
in /var. All the user data is in /home or its sysadmin-determined
equivalents. If the sysadmin needs space, deleting files in /tmp will not
cause a problem.
In summary, Python is being used on systems that have very different
underlying OS use cases. To some extent, the natural use case for Python
is closest to that of Linux/Unix. Running Python on Windows/Mac requires
adapting for those platforms some of the kinds of tools that simplify
operations on Linux/Unix systems. This discussion is essentially about
how far that goes, how to accomplish it, and how to remain compatible with
the existing tools on Linux/Unix.
In the lxml project (http://codespeak.net/lxml), we've just noticed the
following problem with lxml eggs: you can easy_install an egg that won't
work for your Python.
This is because Python can be compiled with either 2 or 4 bytes unicode
as its internal representation. Any egg that contains compiled C code
that uses unicode such as lxml will run into trouble: if it's compiled
with a 4 bytes unicode Python, it won't work on a 2 bytes unicode
Python, and vice versa.
This problem is fairly common in Linux. Many distributions such as
Ubuntu and Fedora compile their python with 4 bytes unicode internal
representation. If you compile a Python interpreter by hand it defaults
to 2 bytes unicode, however. Hand-building a Python interpreter is done
fairly commonly by Linux sysadmins for various reasons.
It would therefore be very nice if it became possible to make eggs for
the different unicode compilation options of Python. This configuration
dimension is a real world issue for any binary Python module that does
anything with unicode text..
In an earlier mail to this list:
M.-A. Lemburg and Phillip Eby had the following discussion:
>>Please make sure that your eggs catch all possible
>>Python binary build dimensions:
>>* Python version
>>* Python Unicode variant (UCS2, UCS4)
>>* OS name
>>* OS version
>>* Platform architecture (e.g. 32-bit vs. 64-bit)
>As far as I know, all of this except the Unicode variant is captured in
>distutils' get_platform(). And if it's not, it should be, since it
>affects any other kind of bdist mechanism.
I'm not sure whether this means this needs to be escalated from
setuptools to the Python interpreter level itself. With this mail, I've
done the job escalating this lxml problem to what appears to be the
right place, though. :)
I have created a setup.py file for distirbution and I bumped into
a small bug when i tried to set my name in the contact field (Tarek Ziadé)
Using string (utf8 file):
line 162, in send_metadata
line 257, in post_to_server
value = unicode(value).encode("utf-8")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 10:
ordinal not in range(128)
line 1094, in write_pkg_file
file.write('Author: %s\n' % self.get_contact() )
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position
18: ordinal not in range(128)
I would propose a patch for this problem but i don't know what would be the
best input (i guess unicode
Tarek Ziadé | Association AfPy | www.afpy.org
Blog FR | http://programmation-python.org
Blog EN | http://tarekziade.wordpress.com/
I would like to summarize here http://bugs.python.org/issue2562.
Currently, distutils does not allows the usage of Unicode for
some meta-data fields that should be able to use it.
These fields are:
For instance, if you use u"Barnabé" in the author field,
the DistributionMetada.write_pkg_file will fail when it
tries to serialize the information into a file.
The problem is that the current implementation makes the
assumption that all fields are ascii string.
This won't be a problem in Python 3k, of course, but currently concerns the
One possible solution would be to move these fields to Unicode for the 2.6
In the meantime, many people are using str type for those fields,
so as Martin mentioned, a backward compatibility would be better
to support either plain string either Unicode.
Other fields should be left imho in ascii, since an url for instance
has to be ascii. But maybe it would be better, as Martin mentioned,
to use Unicode for all fields.
In any case, if we do use Unicode for some fields, we will need
to provide the codec to be used to serialize the data in a file.
My proposal here would be to add a 'encoding' field in the metadata
that defaults to 'utf8', and that would let people explicitely
indicates the encoding.
I have written a quick patch here of a possible implementation, so
you can see the problem :
Tarek Ziadé | Association AfPy | www.afpy.org
Blog FR | http://programmation-python.org
Blog EN | http://tarekziade.wordpress.com/
for our nightly build system I needed the capability to use a different
test runner, namely one that outputs junit compatible xml files.
In order to support that through the setup.py test command I hacked on
Is there a simpler way to do this?
If not you might want to consider attached patch for addition
(Should be against latest svn.)
building lxml requires additional configuration so it finds xslt-config
correctly. One possibility is to set the PATH environment variable. The
other is to call setup.py --xslt-config=...
Using setup.py --xslt-config doesn't fit at all into buildout i think.
Setting environment variables before installing an egg on the other
hand might be useful. Would it make sense to put this into
zc.recipe.egg or would it be better to create some unrelated recipe
which only sets envirionment variables?
gocept gmbh & co. kg · forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon. +49 345 12298894 · fax. +49 345 12298891
At 09:07 PM 4/11/2008 -0700, Cliff Wells wrote:
>I recently upgraded a hosting server from Python 2.4 to Python 2.5.
>Many of the sites on this server couldn't easily be upgraded to 2.5 (at
>least not in a timely fashion), so my interim solution was to simply
>symlink ~/bin/python -> /usr/bin/python2.4 (~/bin is first in the user's
>PATH). This worked swimmingly except for applications which relied on
>Paste (I should note I use the method outlined here:
>The reason the Paste apps had an issue is because apparently setuptools
>modifies the shebang line of paster to be "#!/usr/bin/python". This
>hardcoded path overrides any PATH settings. I understand that this is
>done at the time Paste is installed to tie it to the installed version
>of Python. This makes sense, except that it doesn't do what it's
>intended to when Python is upgraded (/usr/bin/python is no longer the
>version it was installed with).
>It seems the correct solution to this is to use "#!/usr/bin/env
>python" (or rather, evaluate `which env` to account for some systems
>which have /bin/env rather that /usr/bin/env) which allows the sys admin
>to override the Python binary much more easily.
No, it isn't the correct solution. The correct solution is to re-run
easy_install on the target -- it will leave the existing installed
code in place, but regenerate the scripts with headers pointing to
the currently-in-use Python.
Even that is often not as good an idea as reinstalling for a new
version of Python; some packages (notably, setuptools itself, but I
have others) include different code and data depending on the Python
version they are built for. For example, a package built for Python
2.5 might not include dependency specs for ctypes, sqlite, or
wsgiref, but the same package might need to specify those
dependencies on earlier versions of Python.
By the way, please don't send me unsolicited private emails about
setuptools unless you're a client or potential client. There's a
reason that every single official web page about setuptools directs
you to email the distutils-sig. I don't do private email for ANY of
my open source projects, unless you're a client or looking to be
one. Mailing lists have searchable archives, meaning that my time
answering a question is being offset by its potential utility to a
much larger audience. Thanks.
[Apologies if this was discussed in the past, I did some searching but
couldn't find much, but then again my attention is spread a little too thing
Right now setuptools on Windows x64 with 64-bits Python 2.5 is (partially)
The error shown is:
Cannot find Python executable C:\Python25\python.exe
when running easy_install. The phrase comes from launcher.c which is
compiled via MingW to cli.exe and gui.exe. Both of these are present in the
setuptools repository and are 32-bits only for all I can determine (using
file). I have not thoroughly checked it yet (due to being written in Unix-C,
even though it's aimed at Windows), but my guess is it's using some API
calls which fail on 64-bits Windows. I see there's a mingw-64 toolkit on the
'net nowadays. Has anyone tried this yet? Is it indeed an API issue?
Furthermore, when creating an egg on Windows x64, it will create it with an
identifier of win32, even though C code in a project is compiled with an
AMD64 version of the compiler. For all I know 32-bits Windows systems will
also pull down this version of the egg when given the chance.
I guess this is due to Python 2.5 64 bit reporting win32 for sys.platform?
So don't we miss something to properly distinguish between 64 bits Windows
and 32 bits? Especially with x64 and Vista 64 on the market nowadays?
Thanks for any pointers/clues...
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/ | GPG: 2EAC625B
Whoever undertakes to set himself up as judge in the field of truth
and knowledge is shipwrecked by the laughter of the Gods.