Hi, Digging into the current dh_python, I have come across behaviour that I can't explain, related to the handling of the -V flag. Take the case of private pure Python modules. Suppose I have two packages, python-foo and python-bar. In python-foo, I call dh_python -V X.Y, which means that the .py files are meant to be handled by a specific version of python, namely pythonX.Y. Suppose, in python-bar, I instead set XS-Python-Version to X.Y, which means only pythonX.Y is supported.
First question: is XS-Python-Version a mandatory field under policy? It should be, as we can see below, but currently Python policy does not say so. I posit that in either case it has been specified that only version X.Y of python is supported -- but the behaviour of dh_python is different. ,---- | Package: python-foo | Depends: pythonX.Y | XB-Python-Version: X.Y | Provides: pythonX.Y-foo `---- ,---- | Package: python-bar | XB-Python-Version: X.Y | Provides: pythonX.Y-bar `---- Why are we not getting a Depends line in python-bar even though XS-Python-Version states only one version of python is supported? If we had python-baz, an extension module, which has XS-Python-Version: X.Y , we would get: ,---- | Package: python-baz | XB-Python-Version: X.Y | Provides: pythonX.Y-baz | Depends: python (>= X.Y), python (<< X.Y+1) `---- which makes sense. In other words, for private extension modules, we ensure that only one version of python is supported, and no other, but we don't do so for private pure python modules Analysis of code follows. Take chunk One. See how either $deps is modified, or $verdeps{$usepython} is set, depending on whether or not -V flag was used? ---------------------------------------------------------------------- 291 if (/\.py$/ and $private_pydirs_regex and $fn =~ m/(?:$private_pydirs_regex)/) { 292 # Private python module 293 verbose_print("Found private module: $fn"); 294 my $dir; 295 foreach $dir (@dirs) { 296 if ($fn =~ m/\Q$dir\E/) { 297 $dir =~ s/^$tmp//; 298 verbose_print("Memorizing dir to byte-compile: $dir"); 299 $private_dirs_list{"$dir"} = 1; 300 } 301 } 302 if ($dh{V_FLAG_SET}) { 303 $verdeps{$usepython} |= PY_PRIVATE_MODULE; 304 } else { 305 $deps |= PY_PRIVATE_MODULE; 306 } 307 } elsif (/\.so$/ and $private_sodirs_regex and $fn =~ m/(?:$private_sodirs_regex)/) { ---------------------------------------------------------------------- Next up: we add to depends for pure python modules, but only if -V had been called above. ---------------------------------------------------------------------- 374 # Common dependency handling 375 foreach my $pyver (keys %verdeps) { ... 380 # Always add pythonX.Y dependency if some private modules are 381 # byte-compiled with it (or if extensions are 382 # byte-compiled with it) 383 if ($verdeps{$pyver} & (PY_PRIVATE_MODULE|SO_PRIVATE_MODULE)) { 384 addsubstvar($package, "python:Depends", $pyver); 385 } 386 } ---------------------------------------------------------------------- If we had not used -V, however, we get this: We set the variable versions_field, either to current, or the contents of XS-Python-Version. In the case of bar, we get X.Y. ---------------------------------------------------------------------- 424 # Private modules 425 if ($deps & PY_PRIVATE_MODULE) { 426 # Package with private modules can only support one version at a time 427 # (even if the modules can be automatically byte-compiled for any new 428 # python version). 429 unless ($versions_field) { 430 # Unless min/max are the same we put "current" 431 if ($min_version and ($min_version eq $max_version)) { 432 $versions_field = $min_version; 433 } else { 434 $versions_field = "current"; 435 } 436 } 437 } ---------------------------------------------------------------------- What is done with that variable? ---------------------------------------------------------------------- 445 if (scalar keys %pyversions_found) { ... 471 } else { 472 # Still try to describe the versions that the package support 473 $versions_field = $python_header unless $versions_field; 474 $versions_field = "all" unless $versions_field; 475 addsubstvar($package, "python:Versions", $versions_field); 476 477 # Generate provides for all python versions supported 478 if ($package =~ /^python-/) { 479 foreach (grep { $officially_supported{$_} } @versions) { 480 my $virtual = $package; 481 $virtual =~ s/^python-/$python$_-/; 482 addsubstvar($package, "python:Provides", $virtual); 483 } 484 } 485 } ---------------------------------------------------------------------- Hmm, python_header is initialized from XS-Python-Version, which, if it were mandatory, would mean that we would get X.Y in either case. So, we get a XB-Python-Version, and we get a Provides, in either case. But if XS-Python-Version is missing from python-foo, we would get a XB-Python-Version: all and no provides, even though we told dh_python that only one version of python can run our .py files. manoj -- Trying to break out of the Tempter's control, one's mind writhes to and fro, like a fish pulled from its watery home onto dry ground. 34 Manoj Srivastava <[EMAIL PROTECTED]> <http://www.debian.org/%7Esrivasta/> 1024D/BF24424C print 4966 F272 D093 B493 410B 924B 21BA DABB BF24 424C -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]