9

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?

asked Dec 19, 2012 at 12:21

1 Answer 1

7

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).

answered Dec 19, 2012 at 16:03
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.