[Distutils] Are egg files needed when building/installing via --root?
joss at debian.org
Mon Dec 1 09:27:08 CET 2008
Le dimanche 30 novembre 2008 à 20:17 -0700, zooko a écrit :
> Let's put it like this: as the author of an application and some
> libraries written in Python, I would like it if my code could run on
> $operating_system_distribution even before someone has gotten around
> to packaging it for $operating_system_distribution.
This is a completely orthogonal issue.
> Therefore, I
> need a way to tell whether some dependency is already installed. I
> could write a giant switch statement for all known package management
> if platform.dist() == 'debian':
> os.system("dpkg --list...")
> elif platform.dist() == 'redhat':
> os.system("rpm -q...")
> elif platform.system() == 'windows':
> import win32api
> # probe registry ???
> ... etc
And that would be very wrong. Tools like dpkg and rpm are not meant to
be invoked by applications at all.
> Fortunately, pkg_resources does this for me in a generic, cross-
> platform way so that my workload is substantially reduced:
> pkg_resources.require('my_dependency >= 1.0')
This is, TTBOMK, the only framework to do it at runtime. It is much
better to do such things at installation time, since it does not slow
down the application when you have many of them to check, and it allows
to make packages without wondering whether the application will still
behave correctly at runtime.
There are existing tools like pkg-config, which are not restricted to
Python, and that already do things correctly.
: :' : We are debian.org. Lower your prices, surrender your code.
`. `' We will add your hardware and software distinctiveness to
`- our own. Resistance is futile.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Ceci est une partie de message num?riquement sign?e
More information about the Distutils-SIG