diff -Nru /tmp/YUUsCvTFaP/python-defaults-2.3.5/debian/changelog /tmp/HcmtheS2nP/python-defaults-2.3.5/debian/changelog
--- /tmp/YUUsCvTFaP/python-defaults-2.3.5/debian/changelog	2006-06-16 12:29:29.000000000 +0200
+++ /tmp/HcmtheS2nP/python-defaults-2.3.5/debian/changelog	2006-06-22 19:00:19.000000000 +0200
@@ -1,3 +1,12 @@
+python-defaults (2.3.5-10.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Updated pyversions script. "pyversions -r" will now check debian/control
+    for XS-Python-Version and will fallback to debian/pyversions if the first
+    didn't give any result.
+
+ -- Raphael Hertzog <hertzog@debian.org>  Thu, 22 Jun 2006 18:56:34 +0200
+
 python-defaults (2.3.5-10) unstable; urgency=low
 
   * Tighten dependencies between packages built from this source.
diff -Nru /tmp/YUUsCvTFaP/python-defaults-2.3.5/debian/pyversions.1 /tmp/HcmtheS2nP/python-defaults-2.3.5/debian/pyversions.1
--- /tmp/YUUsCvTFaP/python-defaults-2.3.5/debian/pyversions.1	2006-06-11 22:16:21.000000000 +0200
+++ /tmp/HcmtheS2nP/python-defaults-2.3.5/debian/pyversions.1	2006-06-22 19:06:31.000000000 +0200
@@ -19,12 +19,18 @@
 .I -s, --supported
 Show the supported python versions.
 .TP
-.I -r, --requested <version string> | <control file>
+.I -r, --requested [<version string> | <control file> | <pyversions file>]
 Reads the
 .B XS-Python-Version
-value in the source section of a control file and shows all
-matching python versions. The parameter is interpreted as
-a version string, if it is not the name of a file.
+value in the source section of a control file and shows all matching
+python versions. It can do the same with dh_python's debian/pyversions
+file. If the parameter is not a file, it is interpreted as a version
+string (similar to the one in XS-Python-Version).
+
+Without any parameter, it will check in turn debian/control and
+debian/pyversions to find out the matching Python versions. If none of
+them give any result, then it will return the list of supported Python
+versions.
 .TP
 .I -i, --installed
 Show the installed supported python versions.
diff -Nru /tmp/YUUsCvTFaP/python-defaults-2.3.5/debian/pyversions.py /tmp/HcmtheS2nP/python-defaults-2.3.5/debian/pyversions.py
--- /tmp/YUUsCvTFaP/python-defaults-2.3.5/debian/pyversions.py	2006-06-13 08:17:59.000000000 +0200
+++ /tmp/HcmtheS2nP/python-defaults-2.3.5/debian/pyversions.py	2006-06-22 18:56:31.000000000 +0200
@@ -116,6 +116,36 @@
     else:
         return ['python%s' % v for v in versions]
 
+def version_cmp(ver1,ver2):
+    v1=[int(i) for i in ver1.split('.')]
+    v2=[int(i) for i in ver2.split('.')]
+    return cmp(v1,v2)
+
+def requested_versions_bis(vstring, version_only=False):
+    versions = []
+    py_supported_short = supported_versions(version_only=True)
+    for item in vstring.split(','):
+        v=item.split('-')
+        if len(v)>1:
+            if not v[0]:
+                v[0] = py_supported_short[0]
+            if not v[1]:
+                v[1] = py_supported_short[-1]
+            for ver in py_supported_short:
+                try:
+                    if version_cmp(ver,v[0]) >= 0 and version_cmp(ver,v[1]) <= 0:
+                        versions.append(ver)
+                except ValueError:
+                    pass
+        else:
+            if v[0] in py_supported_short:
+                versions.append(v[0])
+    versions.sort(version_cmp)
+    if not version_only:
+        versions=['python'+i for i in versions]
+    return versions
+
+
 def installed_versions(version_only=False):
     import glob
     supported = supported_versions()
@@ -173,7 +203,7 @@
                       action='store_true', dest='supported')
     parser.add_option('-r', '--requested',
                       help='print the python versions requested by a build; the argument is either the name of a control file or the value of the XS-Python-Version attribute',
-                      action='store', dest='versions')
+                      action='store_true', dest='requested')
     parser.add_option('-i', '--installed',
                       help='print the installed supported python versions',
                       action='store_true', dest='installed')
@@ -189,13 +219,35 @@
         print ' '.join(supported_versions(opts.version_only))
     elif opts.installed:
         print ' '.join(installed_versions(opts.version_only))
-    elif opts.versions:
+    elif opts.requested:
         try:
-            if os.path.isfile(opts.versions):
-                vs = extract_pyversion_attribute(opts.versions, 'Source')
+            if len(args) >= 1:
+        	# Use parameters to find out the requested version
+        	if os.path.isfile(args[0]):
+        	    if args[0].find("pyversions") != -1:
+        		vs = file(args[0]).readline().rstrip('\n');
+        		print ' '.join(requested_versions_bis(vs, opts.version_only))
+        	    else:
+        		vs = extract_pyversion_attribute(args[0], 'Source')
+        		print ' '.join(requested_versions(vs, opts.version_only))
+        	else:
+        	    print ' '.join(requested_versions(args[0], opts.version_only))
             else:
-                vs = opts.versions
-            print ' '.join(requested_versions(vs, opts.version_only))
+        	# Check debian/control and debian/pyversions to find out
+        	# requestd versions
+        	done = 0
+        	if os.path.isfile("debian/control"):
+        	    try:
+        		vs = extract_pyversion_attribute("debian/control", 'Source')
+        		print ' '.join(requested_versions(vs, opts.version_only))
+        		done = 1
+        	    except:
+        		pass
+        	if not done and os.path.isfile("debian/pyversions"):
+        	    vs = file("debian/pyversions").readline().rstrip('\n');
+        	    print ' '.join(requested_versions_bis(vs, opts.version_only))
+        	elif not done:
+        	    print ' '.join(supported_versions(opts.version_only))
         except ValueError, msg:
             print "%s: %s" % (program, msg)
             sys.exit(1)
