From 1c5aaf1332c6c00139883eeffe44c563737176ae Mon Sep 17 00:00:00 2001 From: PJ Eby Date: Sat, 19 Nov 2005 19:36:29 +0000 Subject: Kludges to make building packages with '-' in their version work with bdist_rpm. This still doesn't address the issue of building RPMs that don't effectively install as multi-version eggs, but at least now building RPMs for development eggs is possible. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041482 --- setuptools/command/bdist_rpm.py | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'setuptools/command/bdist_rpm.py') diff --git a/setuptools/command/bdist_rpm.py b/setuptools/command/bdist_rpm.py index 2cc3fb18..4db04a32 100755 --- a/setuptools/command/bdist_rpm.py +++ b/setuptools/command/bdist_rpm.py @@ -21,7 +21,24 @@ class bdist_rpm(_bdist_rpm): _bdist_rpm.run(self) def _make_spec_file(self): + version = self.distribution.get_version() + rpmversion = version.replace('-','_') spec = _bdist_rpm._make_spec_file(self) + line23 = '%define version '+version + line24 = '%define version '+rpmversion + spec = [ + line.replace( + "Source0: %{name}-%{version}.tar", + "Source0: %{name}-%{unmangled_version}.tar" + ).replace( + "%setup", + "%setup -n %{name}-%{unmangled_version}" + ).replace(line23,line24) + for line in spec + ] + spec.insert(spec.index(line24)+1, "%define unmangled_version "+version) + + if not self.no_egg: return spec @@ -31,3 +48,35 @@ class bdist_rpm(_bdist_rpm): "setup.py install ","setup.py install --old-and-unmanageable " ) for line in spec ] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.1