* ubuntutools/misc.py:

- Use output of dpkg --print-architecture command to correctly display
    platform architecture
This commit is contained in:
Luca Falavigna 2010-09-20 18:12:39 +02:00
parent 49986f0b78
commit 4b13534eea
2 changed files with 11 additions and 8 deletions

5
debian/changelog vendored
View File

@ -8,8 +8,11 @@ ubuntu-dev-tools (0.103) UNRELEASED; urgency=low
- Add Benjamin Drung to Uploaders. - Add Benjamin Drung to Uploaders.
- Add DM-Upload-Allowed field, this way Benjamin can upload new - Add DM-Upload-Allowed field, this way Benjamin can upload new
versions on his own. versions on his own.
* ubuntutools/misc.py:
- Use output of dpkg --print-architecture command to correctly display
platform architecture (Closes: #594424).
-- Luca Falavigna <dktrkranz@debian.org> Mon, 20 Sep 2010 17:46:46 +0200 -- Luca Falavigna <dktrkranz@debian.org> Mon, 20 Sep 2010 18:11:24 +0200
ubuntu-dev-tools (0.102) experimental; urgency=low ubuntu-dev-tools (0.102) experimental; urgency=low

View File

@ -22,6 +22,7 @@
# Modules. # Modules.
import os import os
from subprocess import Popen, PIPE
from ubuntutools.lp.udtexceptions import PocketDoesNotExistError from ubuntutools.lp.udtexceptions import PocketDoesNotExistError
@ -52,21 +53,20 @@ def system_distribution():
def host_architecture(): def host_architecture():
""" host_architecture -> string """ host_architecture -> string
Detect the host's architecture and return it as a string Detect the host's architecture and return it as a string. If the
(i386/amd64/other values). If the architecture can't be determined, architecture can't be determined, print an error message and return None.
print an error message and return None.
""" """
arch = os.uname()[4].replace('x86_64', 'amd64').replace('i586', 'i386' arch = Popen(['dpkg', '--print-architecture'], stdout=PIPE, \
).replace('i686', 'i386') stderr=PIPE).communicate()[0].split()
if not arch or 'not found' in arch: if not arch or 'not found' in arch[0]:
print 'Error: Not running on a Debian based system; could not ' \ print 'Error: Not running on a Debian based system; could not ' \
'detect its architecture.' 'detect its architecture.'
return None return None
return arch return arch[0]
def readlist(filename, uniq=True): def readlist(filename, uniq=True):
""" readlist(filename, uniq) -> list """ readlist(filename, uniq) -> list