Package: dh-python
Version: 2.20160609~bpo8+1
Severity: normal

Dear Maintainer,

I've been using dh-python to build a package and I've had to add a version
dependency in my setup.py (requests >= 2.4.2) but this isn't being picked up
and added to the debian/control.
The package will depend on python3-request in the control file but without the
versioning string.
Doing a quick look on source.debian.net this isn't a bug only I'm seeing.
http://sources.debian.net/src/pexpect/4.2.0-1/setup.py/ (final line has
install_requires=['ptyprocess>=0.5'])
http://sources.debian.net/src/pexpect/4.2.0-1/debian/control/ (control file
"Build-Depends: dh-python, python-all (>= 2.6.6-3~), python3-all, python-
sphinx, debhelper (>= 9), python-ptyprocess, python3-ptyprocess, python-pytest,
python3-pytest" no versioning on python-ptyprocess)

I believe the source of this is:
dh-python/dhpython/pydist.py

152             if req_d['version'] and (item['standard'] or item['rules'])
and\
153                     req_d['operator'] not in (None, '==', '!='):
154                 v = _translate(req_d['version'], item['rules'],
item['standard'])
155                 return "%s (%s %s)" % (item['dependency'],
req_d['operator'], v)

The offending section is (item['standard'] or item['rules]) the first one is
None the second one is []
and then the whole expression reduces down to "[]" which is False in python so
we fall through to.

156             else:
157                 if item['dependency'] in bdep and
bdep[item['dependency']][None]:
158                     # TODO: handle architecture specific dependencies from
build depends ("None" below)
159                     return "{} ({})".format(item['dependency'],
bdep[item['dependency']][None])
160                 return item['dependency']

Which only gives the package name, not the version depedency.

Changing the code to:

152             if req_d['version'] and (item['standard'] is not None or
item['rules'] is not None) and\
153                     req_d['operator'] not in (None, '==', '!='):
154                 v = _translate(req_d['version'], item['rules'],
item['standard'])
155                 return "%s (%s %s)" % (item['dependency'],
req_d['operator'], v)

Solved the problem and added the version string to the control file. Is this a
valid solution? I'm not sure what exactly the item dictionary is supposed to do
so I might not have setup the package generation properly.
item['standard'] was None in and item['rules'] was an empty list, if the above
isn't a bug is there something I can do to add an entry to the item['rules']
list?

Cheers,
Anthony

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***



-- System Information:
Debian Release: 8.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages dh-python depends on:
pn  python3:any  <none>

dh-python recommends no packages.

Versions of packages dh-python suggests:
ii  libdpkg-perl  1.17.27

-- no debconf information

Reply via email to