[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#378604: dh_python generates dependencies on unversioned python versions for versioned python modules



tag 378604 + patch
thanks

On Mon, 17 Jul 2006, Matthias Klose wrote:
> Package: debhelper
> Version: 5.0.37.3
> Severity: important
> 
> Looking at python2.4-schoolbell, ${python:Depends} is expanded to
> 
>   python-central (>= 0.5), python (<< 2.5), python (>= 2.4) | python2.4
> 
> which is wrong.

It's not really wrong... but it's not really optimized for the purpose of
the package.

The package puts files in /usr/lib/python2.4/site-packages so it won't
work with python2.5 ... the "python (<< 2.5)" guarantees that.

There's no script using "#!/usr/bin/python2.4" otherwise you would have
had a dependency "python2.4" ...

In theory, looking at the package it should have gotten a "python (>=
2.4), python (<< 2.5)" dependency however since that's not satisfiable in
sid right now, it has been loosened to the dependency above.

If modules are meant for public uses, they should work with all python
versions and in that case the dependency they get is the right one. But in
this case, we have public modules which are not really meant to be used by
the end-user and which are only used by one application and thus compiled
for the version that this application uses.

Ideally if they are private modules meant to be used only by the
schoolbell application, then they should be packaged in a private
directory and byte-compiled with the version that schoolbell requires.

However your approach can make sense as well so I wrote the attached
patch.

Cheers,
-- 
Raphaël Hertzog

Premier livre français sur Debian GNU/Linux :
http://www.ouaza.com/livre/admin-debian/
=== modified file 'dh_python'
--- dh_python	
+++ dh_python	
@@ -402,7 +402,13 @@
 
 		# Private extensions, must be rebuilt for each python version
 		if ($deps & SO_PRIVATE_MODULE) {
-			$dep_on_python++;
+			if (($dh{V_FLAG_SET} and ($usepython eq "python$python_version")) or
+			    (($min_version eq $python_version) and ($min_version eq $max_version))
+			   ) {
+				# Depend on python only if the version
+				# used to build is the currently supported one
+				$dep_on_python++;
+			} 
 			# Packages using a private extension can only
 			# support one version
 			# Unless min/max are the same we put $python_version
@@ -454,6 +460,16 @@
 				unless ($stop_version) {
 				    $max_version = max(keys %pyversions_found);
 				    $stop_version = next_minor_version($max_version);
+				}
+			} else {
+				# Current version is not supported by the package
+				if ($min_version and ($min_version eq $max_version)) {
+					# If we support only one non-standard python
+					# version, the depend on that version and not on python
+					$dep_on_python--;
+					if (! $dep_on_python) {
+						addsubstvar($package, "python:Depends", "python$min_version");
+					}
 				}
 			}
 			# Generate the Python-Version field


Reply to: