The order in which dh_python3 writes Depends in not stable accross builds.

Detection

Example diffp output:

----- ./control
-Depends: python3-pkg-resources, python3:any (>= 3.3.2-2~), python3-lazr.uri
+Depends: python3:any (>= 3.3.2-2~), python3-lazr.uri, python3-pkg-resources

Solution

dh-python needs a patch. It looks like we need to add sorting in dhpython/depends.py:Dependencies.export_to.

Packages known to be affected

Source

Tested version

awscli

1.2.9-2

backup2swift

0.8-1

boost1.54

1.54.0-4

boost1.55

1.55.0-1

bpython

0.12-1

cloud-sptheme

1.6-1

cookiecutter

0.6.4-1

cracklib2

2.9.0-2

debmake

4.0.6-1

deltarpm

3.6+dfsg-1

django-ldapdb

0.2.0-1

etm-qt

2.3.21-1

fedmsg-meta-debian

0.2-1

flask-migrate

1.1.1-1

flask-principal

0.4.0-1

flask-script

0.6.6-1

flask-sqlalchemy

1.0-1

flufl.bounce

2.2.1-1

geis

2.2.16-1

glances

1.7.3-2

gnome-music

3.10.1-2

gquilt

0.25-3

ibus-cangjie

2.0-1

ipdb

0.8-1

isrcsubmit

2.0.0~beta.5-1

libguestfs

1.24.5-1

logster

0.0.1-1

marisa

0.2.4-5

menulibre

2.0.1-1

mpi4py

1.3.1+hg20131106-1

openstack-nose

0.11-1

plainbox

0.4-4

py3cairo

1.10.0+dfsg-3

pycangjie

1.0-1

pycarddav

0.6.1-1

pymia

0.1.5-2

pytaglib

0.3.6+dfsg-2

pytest-instafail

0.1.0-1

pytest

2.5.1-1

python-bcdoc

0.12.0-2

python-botocore

0.29.0+repack-1

python-cffi

0.8.1-1

python-colander

1.0b1-3

python-ecdsa

0.10-2

python-falcon

0.1.7-3

python-flake8

2.0-2

python-fontconfig

0.5.1-1

python-jedi

0.7.0-1

python-lesscpy

0.9j-3

python-libdiscid

0.4.1-1

python-memprof

0.3.3-2

python-numpy

1.7.1-3

python-scipy

0.12.0-3

python-srp

1.0.4-1

python-wadllib

1.3.2-2

pytools

2013.5.7-1

pyyaml

3.10-4

requests-aws

0.1.5-1

routes

2.0-1

sparql-wrapper-python

1.5.2-2

tornadio2

0.0.4-1

tryton-modules-company-work-time

3.0.0-2

tryton-modules-product

3.0.0-2

tryton-modules-stock-inventory-location

3.0.0-2

tryton-modules-stock-lot

3.0.0-2

upstart

1.11-1

urwid

1.1.1-1

yafaray

0.1.5-3

yp-svipc

0.14-2

logbook

0.6.0-1

python-dvdvideo

0.20130117+nmu1

uucp-lmtp

0.20130117+nmu1