Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any ways to define grouped conditional dependencies in debian/control?

I'm debianizing a Python package, which has a bit weird dependencies. It either:

  • Depends on python2.7
  • Depends on python2.6 and python-ordereddict (my self-built package for ordereddict on PyPI)

For example, in my setup.py I have:

deps = ["Flask >=0.8"]
if not hasattr(collections, "OrderedDict"): # Python 2.6
    deps.append("ordereddict")

setup(
    …
    install_requires=deps,
    …
)

I haven't found anything in Debian packaging documentation on this matter. Just out of the blue I've tried writing

Depends: ..., python2.7 | (python2.6, python-ordereddict)

But, no surprisingly, it is a wrong syntax that didn't work:

dpkg-gencontrol: warning: can't parse dependency (python2.6

I'm using dh_python2 and ${python:Depends} provides quite unreasonable list like

Depends: python2.7 | python2.6, python (>= 2.7.1-0ubuntu2),
    python (<< 2.8), python-flask, python-ordereddict

With such dependency list, it'll require python-ordereddict for python2.7, that does not exist. And obviously I can't patch python2.7-minimal to say Provides: python-ordereddict (like it's done with python-argparse).

Any suggestions on how to correctly package such library, please?

like image 641
drdaeman Avatar asked Dec 19 '12 12:12

drdaeman


1 Answers

One option would be to let python-ordereddict depend on python2.6, then let your main package depend on python2.7 | python-ordereddict. I'm assuming it doesn't make sense to install python-ordereddict with 2.7, since OrderedDict is available in that release.

Of course, that's ugly because it pushes the dependency of the main package into the library. The alternative is to realize that dependencies must be propositional formulas in conjunctive normal form (CNF). By applying the distributive law of propositional logic, you can convert

python2.7 | (python2.6, python-ordereddict)

to the equivalent CNF

python2.7 | python2.6, python2.7 | python-ordereddict

(which, I admit, isn't particularly pretty either).

like image 156
Fred Foo Avatar answered Nov 21 '22 12:11

Fred Foo