pull-debian-source fails with "ImportError: No module named request"

Bug #1841127 reported by Robie Basak
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ubuntu-dev-tools (Ubuntu)
Fix Released
High
Unassigned

Bug Description

On Eoan with ubuntu-dev-tools 0.171

$ /usr/bin/pull-debian-source
Traceback (most recent call last):
  File "/usr/bin/pull-debian-source", line 22, in <module>
    import urllib.request
ImportError: No module named request

Root cause: despite the "/usr/bin/python3" shebang in the source, setuptools modifies this to "/usr/bin/python" because setup.py ran with Python 2 during the build, and so the "build" pull-debian-source tool no longer works.

I'm not sure how to fix this while moving towards Python 3 without porting everything else or making pull-debian-source (and incrementally everything else until the porting is done) dual 2/3.

Workaround: hack your /usr/bin/pull-debian-source shebang to use Python 3. I also noticed that there's no dependency on python3-ubuntutools, so you may need to install that.

This bug is my fault. I had assumed that testing pull-debian-source by running it straight from the source tree would be sufficient when I ported it to Python 3 in the process of fixing a different bug.

Tags: eoan
Revision history for this message
Robie Basak (racb) wrote :

02:11 <ScottK> Pretty sure you can turn off shebang rewriting. I think it's dh_python, not setuptools.

Revision history for this message
Dan Streetman (ddstreet) wrote :

guess I should merge my pull-* rewrite to debian sometime soon.

Revision history for this message
Mattia Rizzolo (mapreri) wrote :

@ddstreet, yes please.

Also, the solution here is to port everything to py3-only, btw.

tags: added: eoan
Changed in ubuntu-dev-tools (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Stefano Rivera (stefanor) wrote :
Revision history for this message
Robie Basak (racb) wrote :

Thank you! It wasn't clear to me how to resolve this.

Revision history for this message
Mattia Rizzolo (mapreri) wrote :

Thank you indeed!

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-dev-tools - 0.172

---------------
ubuntu-dev-tools (0.172) unstable; urgency=medium

  [ Mattia Rizzolo ]
  * autopkgtest: Add a allow-stderr restriction, as things log to stderr.

  [ Stefano Rivera ]
  * Build-Depend on pylint (>= 2, the Python 3 version), it replaced pylint3.
  * Explicitly declare python dependencies in the python library modules (the
    setup.py doesn't provide these) and ubuntu-dev-tools itself.
  * dh_python2 doesn't generate a python dependency in ubuntu-dev-tools, now
    that it's scripts-only, so manually declare one.
  * Install pull-debian-source as python 3. It was ported, and doesn't work
    under python 2 any more. LP: #1841127
  * Use dh_install to split the build into multiple binary packages.

 -- Mattia Rizzolo <email address hidden> Wed, 04 Sep 2019 08:44:51 +0200

Changed in ubuntu-dev-tools (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.