tags 399986 + patch
thanks

Hi,

Attached is the diff for my python-central 0.5.12 NMU.

I changed python-central accept installing packages providing only support
of old python versions. I didn't add "unsupported" versions since we now
have 2.5 in sid and we have no experience in handling addition of new
upstream version from that point of view.

But I suggest enabling that post-etch of course.

Cheers,
-- 
Raphaël Hertzog

Premier livre français sur Debian GNU/Linux :
http://www.ouaza.com/livre/admin-debian/
diff -Nru /tmp/YU1MgPcx9o/python-central-0.5.11/debian/changelog 
/tmp/sdAGhjKHsf/python-central-0.5.12/debian/changelog
--- /tmp/YU1MgPcx9o/python-central-0.5.11/debian/changelog      2006-11-22 
12:35:39.000000000 +0100
+++ /tmp/sdAGhjKHsf/python-central-0.5.12/debian/changelog      2006-11-23 
11:13:11.000000000 +0100
@@ -1,3 +1,11 @@
+python-central (0.5.12) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Accept packages providing support of only old python runtimes.
+    Closes: #399986
+
+ -- Raphael Hertzog <[EMAIL PROTECTED]>  Thu, 23 Nov 2006 10:28:23 +0100
+
 python-central (0.5.11) unstable; urgency=low
 
   * Non-maintainer upload.
diff -Nru /tmp/YU1MgPcx9o/python-central-0.5.11/pycentral.py 
/tmp/sdAGhjKHsf/python-central-0.5.12/pycentral.py
--- /tmp/YU1MgPcx9o/python-central-0.5.11/pycentral.py  2006-11-22 
17:59:26.000000000 +0100
+++ /tmp/sdAGhjKHsf/python-central-0.5.12/pycentral.py  2006-11-23 
11:01:54.000000000 +0100
@@ -867,14 +867,19 @@
         bc_option = config.get('DEFAULT', 'byte-compile')
         pkg = DebPackage('package', self.args[0], oldstyle=False)
         pkg.read_version_info()
+        requested = 
pyversions.requested_versions_for_runtime(pkg.version_field, version_only=True)
+        used_runtimes = [rt for rt in runtimes if rt.short_name in requested]
         try:
             pkg.set_default_runtime_from_version_info()
         except ValueError:
-            # package needs an unavailable runtime.
-            self.error('%s needs unavailable runtime (%s)'
-                       % (self.pkgname, pkg.version_field))
-        requested = pyversions.requested_versions(pkg.version_field, 
version_only=True)
-        used_runtimes = [rt for rt in runtimes if rt.short_name in requested]
+           # Package doesn't provide support for any supported runtime
+           if len(used_runtimes) == 0:
+               self.error('%s needs unavailable runtime (%s)'
+                          % (self.pkgname, pkg.version_field))
+           else:
+               # Still byte compile for the available runtimes (with the
+               # first matching runtime)
+               pkg.default_runtime = get_runtime_for_version(used_runtimes[0])
         logging.debug('\tavail=%s, pkg=%s, install=%s'
                       % ([rt.short_name for rt in runtimes],
                          pkg.version_field,
diff -Nru /tmp/YU1MgPcx9o/python-central-0.5.11/pyversions.py 
/tmp/sdAGhjKHsf/python-central-0.5.12/pyversions.py
--- /tmp/YU1MgPcx9o/python-central-0.5.11/pyversions.py 2006-10-06 
12:55:22.000000000 +0200
+++ /tmp/sdAGhjKHsf/python-central-0.5.12/pyversions.py 2006-11-23 
11:05:42.000000000 +0100
@@ -152,6 +152,43 @@
     else:
         return ['python%s' % v for v in versions]
 
+# This function is used by python-central to decide which installed
+# runtimes must be supported. It's not nice, but it's designed to mimic
+# closely requested_versions in an attempt to avoid introducing bugs this
+# late in the release cycle. Some cleanup is in order post-etch though.
+def requested_versions_for_runtime(vstring, version_only=False):
+    versions = None
+    vinfo = parse_versions(vstring)
+    old = old_versions(version_only=True)
+    unsupported = unsupported_versions(version_only=True)
+    supported = supported_versions(version_only=True)
+    # You might want to add unsupported versions too... later.
+    supported.extend(old)
+    if len(vinfo) == 1:
+        if 'all' in vinfo:
+            versions = supported
+        elif 'current' in vinfo:
+            versions = [default_version(version_only=True)]
+        else:
+            versions = vinfo['versions'].intersection(supported)
+    elif 'all' in vinfo and 'current' in vinfo:
+        raise ValueError, "both `current' and `all' in version string"
+    elif 'all' in vinfo:
+        versions = versions = vinfo['versions'].intersection(supported)
+    elif 'current' in vinfo:
+        current = default_version(version_only=True)
+        if not current in vinfo['versions']:
+            raise ValueError, "`current' version not in supported versions"
+        versions = [current]
+    else:
+        raise ValueError, 'error in version string'
+    if not versions:
+        raise ValueError, 'empty set of versions'
+    if version_only:
+        return versions
+    else:
+        return ['python%s' % v for v in versions]
+
 def installed_versions(version_only=False):
     import glob
     supported = supported_versions()

Reply via email to