Hi all --
at long last, I have fixed two problems that a couple people noticed a
* I folded in Amos Latteier's NT patches almost verbatim -- just
changed an `os.path.sep == "/"' to `os.name == "posix"' and added
some comments bitching about the inadequacy of the current library
installation model (I think this is Python's fault, but for now
Distutils is slavishly aping the situation in Python 1.5.x)
* I fixed the problem whereby running "setup.py install" without
doing anything else caused a crash (because 'build' hadn't yet
been run). Now, the 'install' command automatically runs 'build'
before doing anything; to make this bearable, I added a 'have_run'
dictionary to the Distribution class to keep track of which commands
have been run. So now not only are command classes singletons,
but their 'run' method can only be invoked once -- both restrictions
enforced by Distribution.
The code is checked into CVS, or you can download a snapshot at
Hope someone (Amos?) can try the new version under NT. Any takers for
BTW, all parties involved in the Great "Where Do We Install Stuff?"
Debate should take a good, hard look at the 'set_final_options()' method
of the Install class in distutils/install.py; this is where all the
policy decisions about where to install files are made. Currently it
apes the Python 1.5 situation as closely as I could figure it out.
Obviously, this is subject to change -- I just don't know to *what* it
Greg Ward - software developer gward(a)cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
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/
Nicolas Chauvat wrote:
>> Also some of the Debian Python packages are broken or grossly
> File a bug report :)
Yes, because that automatically frees up the packager's time to work on
> My problem with setup tools is that they come from windows
I don't think that's the case at all.
> is (almost) no package management system. The consequence is that
> their author reinvented the wheel, but limited it to Python, then
> moved to eggs and made things worse.
Yes, the egg format is annoying.
No, I don't think having a package management system that targets only
python packages is a bad idea.
> My main tool is Python, but I have many other tools on my system. I
> do not want to have as many package management utilities as
Then I suggest you volunteer to maintain the debian packages for every
single python package.
> If I have one tool for Python, one for Java, one for C,
> one for Fortran, one for C libraries, one for Gnome, etc. integration
> becomes a nightmare.
If you have projects this large, then you likely want to roll your own
OS packages anyway.
> [Please note that for an experienced Debian developer, making the
> initial package of a Python module can be a matter of half an hour to
> a couple hours and releasing a new version a matter of minutes.]
...and for someone not using Debian or not an experienced Debian
developer? Despite being a fan of Debian, I'm well aware of just how
"friendly" a community it can be to the new user...
Simplistix - Content Management, Zope & Python Consulting
(I'll be CC'ing the distutils sig in to these replies as this discussion
probably belongs there...)
Nicolas Chauvat wrote:
>> The slides for my two talks can be found here:
> "Python Package Management Sucks"
> Install debian and get back to productive tasks.
This is an almost troll-like answer.
See page 35 of the presentation.
If you're too lazy, here's a re-hash:
- there are lots of different operating systems
- even with Linux, there are many different package management systems
- all the package management systems behave differently and expect
packages to be set up differently for them
- expecting package developers to shoulder this burden is unfair and
results in various bitrotting repackaged versions of python packages
rather than just one up-to-date version maintained by the entity
originating the python package
- Adobe Photoshop Plugins, Firefox Add-ons, etc do not delegate their
management to an OS package manager. Packages are Python's "plugins" and
so should get the same type of consistent, cross-platform package
management targetted at the application in question, which is Python in
Simplistix - Content Management, Zope & Python Consulting
Distutils has made my life easier as an python application author and packager
for some time but when it comes to generating and distributing message
catalogues for translations, things get unexpectedly tricky.
It would be nice to be able to do something like,
from distutils.core import setup
description="A handy, translated application",
po_files = [('share/locales', ['po/*.po'])]
and have distutils do the right thing with the .po files at build time (generate
.mo files from them) and at install time (install them into
PREFIX/share/locales/LC_MESSAGES/, or wherever the distribution is configured to
My big question is, are there plans to add msgfmt functionality into distutils?
Googling tells me there was some discussion about this back in 2003 but I can't
find any sign of progress since then.