I'm debianizing a Python package, which has a bit weird dependencies. It either:
python2.7
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?
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With