interface to download source code tree

Bug #118788 reported by Martin Pitt
4
Affects Status Importance Assigned to Milestone
python-apt (Debian)
Fix Released
Undecided
Unassigned
python-apt (Ubuntu)
Fix Released
Wishlist
Julian Andres Klode

Bug Description

Binary package hint: python-apt

It would be handy to have a Pythonic interface for downloading the source of a package to a given directory, with an appropriate selection of versions. right now I use something like

        try:
            os.chdir(dir)
            argv = ['apt-get', 'source', srcpackage]
            if version:
                argv[-1] += '=' + version
            try:
                if subprocess.call(argv, stdout=subprocess.PIPE,
                    stderr=subprocess.PIPE) != 0:
                    return None
            except OSError:
                return None
        finally:
            os.chdir(orig_cwd)

Martin Pitt (pitti)
Changed in python-apt:
importance: Undecided → Wishlist
Revision history for this message
Martin Pitt (pitti) wrote :

It would be very helpful if this could return the actual directory this was unpacked in. Without this, figuring out the actual source package name and version is pretty hard. E. g. 'apt-get source libgnome2-common' would create a directory 'libgnome-2.18.0'.

Revision history for this message
Julian Andres Klode (juliank) wrote :

You mean something like the attached function? It's actually very easy to write something like this, especially with documentation available now.

Changed in python-apt:
assignee: nobody → juliank
Revision history for this message
Martin Pitt (pitti) wrote :

Thanks, Julian. However, that's actually even more complicated than my current code. :-)

However, if that was a standard function in python-apt, it would be great to have an use. Michael, do you think something like this would fit into python-apt? Thanks!

Revision history for this message
Julian Andres Klode (juliank) wrote :

I have fixed this in python-apt 0.7.9, it just needs to be merged into karmic.

Changed in python-apt (Debian):
status: New → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (3.4 KiB)

This bug was fixed in the package python-apt - 0.7.10.3ubuntu1

---------------
python-apt (0.7.10.3ubuntu1) karmic; urgency=low

  * merged from debian, remaining changes:
    - updated mirrors
    - build python2.4
    - use DH_PYCENTRAL=include-links
    - use --install-layout=deb
    - pre-build.sh: update ubuntu mirrors on bzr-buildpackage

python-apt (0.7.10.3) unstable; urgency=low

  * apt/package.py: Handle cases where no candidate is available, by returning
    None in the candidate property. (Closes: #523801)

python-apt (0.7.10.2) unstable; urgency=low

  * apt/package.py: Handle cases where no candidate is available and
    one of the deprecated properties (e.g. candidateVersion) is
    requested. (Closes: #523801)
  * setup.py, debian/rules: Support version in setup.py again by getting
    the value from the variable DEBVER (defined in debian/rules), falling
    back to None.

python-apt (0.7.10) unstable; urgency=low

  * Build-Depend on python-debian, use it to get version number from changelog
  * Depend on libjs-jquery, and remove internal copy (Closes: #521532)
  * apt/package.py:
    - Introduce Version.{uri,uris,fetch_binary()}
  * debian/control:
    - Remove mdz from Uploaders (Closes: #521477), add myself.
    - Update Standards-Version to 3.8.1
    - Use ${binary:Version} instead of ${Source-Version}
    - Fix spelling error: python -> Python
  * debian/copyright: Switch to machine-interpretable copyright
  * Fix documentation building
    - doc/source/conf.py: Only include directories for current python version.
    - debian/control: Build-Depend on python-gtk2, python-vte.
    - setup.py: If pygtk can not be imported, do not build the documentation.
  * Breaks: debdelta (<< 0.28~) to avoid more problems due to the internal
    API changes from 0.7.9.

python-apt (0.7.9) unstable; urgency=low

  [ Julian Andres Klode ]
  * apt/gtk/widgets.py:
    - Handle older versions of python-gobject which do not ship glib
  * apt/package.py: Introduce the Version class
    - Deprecate Package.candidate*() and Package.installed*(), except for
      installedFiles.
    - Provide Version.get_source() (LP: #118788)
    - Provide Package.versions (Closes: #513236)
  * apt/progress/: New package, replaces apt.progress and apt.gtk
    - apt/progress/gtk2.py: Moved here from apt/gtk/widgets.py
    - apt/progress/__init__.py: Move here from apt/progress.py
  * doc/source/*: Improve the documentation
    - Document more attributes and functions of apt_pkg (they are all listed)

  [ Michael Vogt ]
  * aptsources/distro.py:
    - use iso_3166.xml instead of iso_3166.tab
    - fix incorrect indent
  * debian/control:
    - add Recommends to iso-codes (for iso_3166.xml)
  * apt/package.py:
    - make sure to set the defaulttimeout back to the
      original value (in getChangelog(), LP: #314212)
      Closes: #513315
  * apt/cache.py:
    - when setting a alternative rootdir, read the
      config from it as well
  * python/configuration.cc, python/apt_pkgmodule.cc:
    - add apt_pkg.ReadConfigDir()
  * python/cache.cc, tests/getcache_mem_corruption.py:
    - test if progress objects have the right methods
      and raise error if not (thanks...

Read more...

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

Other bug subscribers

Bug attachments

Remote bug watches

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