[Distutils] setuptools: .egg-info/ and PKG-INFO
Ian Bicking
ianb at colorstudy.com
Tue Oct 25 23:30:39 CEST 2005
I'm trying to figure out how I should deal with the .egg-info directory,
and PKG-INFO.
Right now PKG-INFO is being generated from setup.py. So I don't want to
put it in my source control repository, since it is derivative. But I'm
maintaining by hand some other files in the .egg-info directory, usually
custom package metadata that we consume internally, so I need those
files (and .egg-info) in the repository, and hence in the checkout.
However, without PKG-INFO lots of things break, as pkg_resources gives a
ValueError during some operations (e.g.: ValueError: ("Missing
'Version:' header and/or PKG-INFO file", ProjectName [unknown version]
(/usr/home/ianb/co/IscapeLib/tests/appsetup/output/Proj-05))) -- this
happens anytime I iterate over entry points, including when setuptools
iterates over entry points, which means lots of setup.py commands are
broken. They are broken simply because the incomplete .egg-info
directory is on the path, even though I don't need direct access to it.
I can run setup.py egg_info (creating PKG-INFO) for some reason (that
I have not yet determined), but not my own custom setup.py extensions.
This includes stuff like "python setup.py egg_info my_custom_command",
so I have to write PKG-INFO in a completely separate command. If the
.egg-info directory doesn't exist then pkg_resources will be happy,
because it won't try to read the package as an egg at all. But it does,
and so it's just awkward.
Frankly I'd be 100% okay putting PKG-INFO in source control if it was
the authoritative source, and I don't particularly care to use setup.py
for this data. But that's a cop-out, I should really figure this out as
it is.
So... what do I do here? Should pkg_resources really just ignore
packages without a PKG-INFO file? At least during scan? If I have to
live with running setup.py egg_info until 0.6a7, that's fine.
BTW, here's the full traceback I get:
Traceback (most recent call last):
File "setup.py", line 18, in ?
package_data={
File "/usr/local/lib/python2.4/distutils/core.py", line 135, in setup
ok = dist.parse_command_line()
File "/usr/home/ianb/co/setuptools/setuptools/dist.py", line 227, in
parse_command_line
result = _Distribution.parse_command_line(self)
File "/usr/local/lib/python2.4/distutils/dist.py", line 432, in
parse_command_line
args = self._parse_command_opts(parser, args)
File "/usr/home/ianb/co/setuptools/setuptools/dist.py", line 549, in
_parse_command_opts
nargs = _Distribution._parse_command_opts(self, parser, args)
File "/usr/local/lib/python2.4/distutils/dist.py", line 490, in
_parse_command_opts
cmd_class = self.get_command_class(command)
File "/usr/home/ianb/co/setuptools/setuptools/dist.py", line 353, in
get_command_class
ep.require(installer=self.fetch_build_egg)
File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 1637, in
require
working_set.resolve(self.dist.requires(self.extras),env,installer))
File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 480, in
resolve
env = Environment(self.entries)
File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 558, in
__init__
self.scan(search_path)
File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 588, in scan
self.add(dist)
File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 610, in add
if dist not in dists:
File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 1760, in
__cmp__
def __cmp__(self, other): return cmp(self.hashcmp, other)
File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 1760, in
__cmp__
def __cmp__(self, other): return cmp(self.hashcmp, other)
File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 1755, in
<lambda>
lambda self: (
File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 1782, in
parsed_version
self._parsed_version = pv = parse_version(self.version)
File "/usr/home/ianb/co/setuptools/pkg_resources.py", line 1797, in
version
raise ValueError(
ValueError: ("Missing 'Version:' header and/or PKG-INFO file",
ProjectName [unknown version]
(/usr/home/ianb/co/IscapeLib/tests/appsetup/output/Proj-05))
--
Ian Bicking / ianb at colorstudy.com / http://blog.ianbicking.org
More information about the Distutils-SIG
mailing list