Hello, guys,

I have fixed distutils (and setuptools remains working) with the attached 
patch.  Now, RPMs will be built according to the Fedora Package Naming 
Guidelines:

http://fedoraproject.org/wiki/Packaging/NamingGuidelines#Non-
Numeric_Version_in_Release

which I understand to be the most useful reference in terms of naming pre-
release packages.  This should work correctly in at least:

- Fedora
- RHEL
- SUSE

I urge you patch your python 2.4s and 2.5s and 2.6s and push this update to 
distributions.  I have done that myself at my own repository.

Now we can enjoy one more reason to build RPMs (and eggs! ... according to my 
workbench at http://yum.rudd-o.com/SCRIPTS/ -- feel free to pick its brains) 
DIRECTLY from the cheese shop, especially if you're using pip.

Oh, I also have pip at my repo (cd ../RPMS/noarch in my workbench).

See attached patch.  I will log bugs where it corresponds too.
-- 

        Manuel Amador (Rudd-O) <rud...@rudd-o.com>
        Rudd-O.com - http://rudd-o.com/
        GPG key ID 0xC8D28B92 at http://wwwkeys.pgp.net/

Now playing, courtesy of Amarok: Aqua - Cartoon heroes
Windows 95 is not a virus.  Viruses actually do something.

--- distutils/command/bdist_rpm.py	2009-03-10 16:43:08.000000000 -0500
+++ distutils/command/bdist_rpm.py	2009-03-10 17:25:31.000000000 -0500
@@ -383,10 +383,21 @@
         list of strings (one per line).
         """
         # definitions and headers
+        version = self.distribution.get_version()
+        release = self.release.replace('-','_')
+        import re ; regex = '[^0-9\.]'
+        splits = re.split(regex,version,maxsplit=1)
+        firstnonalnumchar = re.findall(regex,version)
+        if len(splits) == 1:
+               pass
+        else:
+               version = splits[0]
+               release = "0." + release + "." + firstnonalnumchar[0] + splits[1]
         spec_file = [
             '%define name ' + self.distribution.get_name(),
             '%define version ' + self.distribution.get_version().replace('-','_'),
-            '%define release ' + self.release.replace('-','_'),
+            '%define version ' + version,
+            '%define release ' + release,
             '',
             'Summary: ' + self.distribution.get_description(),
             ]
@@ -411,8 +422,10 @@
         else:
             spec_file.append('Source0: %{name}-%{version}.tar.gz')
 
+        license = self.distribution.get_license()
+        if len(license.splitlines()) > 1: license = "Other"
         spec_file.extend([
-            'License: ' + self.distribution.get_license(),
+            'License: ' + license,
             'Group: ' + self.group,
             'BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot',
             'Prefix: %{_prefix}', ])

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to