Hello,
while using distutils shipped with Python 2.4.2, I found out a problem when
running bdist_rpm if the version of the package contains an hyphen ('-'). The
problem is that RPMs do not support hyphens in versions, and bdist_rpm tries to
work around this by replacing hyphens with underscores ('_'). While this is the
correct solution, it appears to be incomplete, because bdist_rpm invokes
'sdist' to build the .tar.gz (or .tar.bz2) without notifying it of the change
of the version string (and thus of the change of the filename that sdist will
have to generate).
I have succesfully worked around this bug with this hack in my setup.py:
class _bdist_rpm(bdist_rpm):
def run_command(self, cmd, *args, **kwargs):
if cmd == "sdist":
old_version = self.distribution.metadata.version
if self.distribution.metadata.version is not None:
self.distribution.metadata.version = old_version.replace("-",
"_")
bdist_rpm.run_command(self, cmd, *args, **kwargs)
self.distribution.metadata.version = old_version
return
bdist_rpm.run_command(self, cmd, *args, **kwargs)
This works by patching the version at the moment of the call to 'sdist' from
within bdist_rpm. Of course it's a gross hack but I couldn't find a better way
:)
Thanks,
Giovanni Bajo