Provide example for apt_pkg.config.find("APT::Architecture")

Bug #194374 reported by Onkar Shinde
2
Affects Status Importance Assigned to Milestone
python-apt (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: python-apt

In one of the example programs (/usr/share/doc/python-apt/examples/config.py) an api 'apt_pkg.Architecture' is used to retrive the apt architecture.
But trying to use this fails with following error

Traceback (most recent call last):
  File "arch.py", line 5, in <module>
    print apt_pkg.Architecture
AttributeError: 'module' object has no attribute 'Architecture'

The api 'apt_pkg.Config.Find("APT::Architecture")' works properly.

Example program:

#!/usr/bin/python
import apt_pkg

apt_pkg.init()
print "Find api: " + apt_pkg.Config.Find("APT::Architecture")
print "Direct arch value: " + apt_pkg.Architecture

Tags: bitesize
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for your bugreport.

This example was removed from the python-apt package. Is that sufficient or would you want to have a api addition to get the architecure easily?

Changed in python-apt:
assignee: nobody → mvo
status: New → Incomplete
Revision history for this message
Onkar Shinde (onkarshinde) wrote :

Ideally I would like to have an API to get architecture easily. But I don't mind removal of example instead, provided I can easily find another example for the correct API.

Changed in python-apt:
status: Incomplete → New
Michael Vogt (mvo)
summary: - [hardy] API 'apt_pkg.Architecture' not present
+ Provide example for apt_pkg.config.find("APT::Architecture")
Changed in python-apt (Ubuntu):
assignee: Michael Vogt (mvo) → nobody
tags: added: bitesize
Revision history for this message
Julian Andres Klode (juliank) wrote :

A fix has been committed to the debian-experimental branch. It can be seen at:

http://bzr.debian.org<email address hidden>

------------------------------------------------------------
revno: 514
revision-id: <email address hidden>
parent: <email address hidden>
fixes bug(s): https://launchpad.net/bugs/194374
committer: Julian Andres Klode <email address hidden>
branch nick: debian-experimental
timestamp: Mon 2011-04-11 12:05:15 +0200
message:
  doc/examples: Add example on how to get architecture names (LP: #194374)

Changed in python-apt (Ubuntu):
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-apt - 0.8.0~exp4ubuntu1

---------------
python-apt (0.8.0~exp4ubuntu1) oneiric; urgency=low

  * Merged from debian/experimental, remaining changes:
    - updated mirror list
    - do not disable 0.7 compat API yet

python-apt (0.8.0~exp4) experimental; urgency=low

  * apt_pkg: Add OrderList, wanted for mancoosi (Closes: #623485)
  * apt_pkg: Add subclassing fun to PackageManager, for #623485 as well
  * apt.cache: Emit change signals in ProblemResolver
  * apt.Cache: Add a _changes_count member for later use

python-apt (0.8.0~exp3) experimental; urgency=low

  [ Stéphane Graber ]
  * Update enable_component to also apply to -src entries (LP: #758732)

  [ Julian Andres Klode ]
  * apt_pkg: Add apt_pkg.Version.multi_arch and friends

python-apt (0.8.0~exp2) experimental; urgency=low

  * aptsources: Parse multi-arch sources.list files correctly
  * aptsources: Allow insertion of new multi-arch entries
  * aptsources: Various cleanup work
  * all: Fix all instances of ResourceWarning about unclosed files
  * tests/test_apt_cache.py: Use assertTrue() instead of assert_()
  * apt_pkg: Raise error when parse_commandline gets empty argv (LP: #707416)
  * apt_pkg: Fix time_to_str, time_rfc1123 to accept more correct values
    (time_to_str accepts unsigned long, time_rfc1123 long long, y2k31-correct).
  * apt.progress: Use long for ETA, natural type for size (LP: #377375)
  * aptsources/sourceslist.py: s/aptsource.py/sourceslist.py/ (LP: #309603)
  * doc/examples: Add example on how to get architecture names (LP: #194374)
  * apt_pkg: Fix unsigned/long-vs-int issues (LP: #610820)
  * apt.cache: Document that update() may need an open() (Closes: #622342)
  * apt.cache: Add a fetch_archives() method (Closes: #622347)
  * doc: Fix a minor formatting error, patch by Jakub Wilk (Closes: #608914)
  * apt.package: Add 'tasks' to Version, improve doc (Closes: #619574)
  * doc: Fix documentation of BaseDependency.relation (Closes: #607031)

python-apt (0.8.0~exp1) experimental; urgency=low

  * Disable the old-style API, and break all packages using it
  * Add an 'is_multi_arch' attribute to apt_pkg.Cache
  * Add apt_pkg.Group class, wrapping pkgCache::GrpIterator
  * Change apt_pkg.Cache() so that passing None for 'progress' results in
    no progress output
  * Support (name, arch) tuples in apt_pkg.Cache mappings, wrapping
    FindPkg() with two string parameters.
  * Introduce apt_pkg.Cache.groups and apt_pkg.Cache.group_count
  * Fix debian/rules to work correctly with tilde in version number
 -- Michael Vogt <email address hidden> Tue, 24 May 2011 10:08:56 +0200

Changed in python-apt (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.