Mercurial > treepkg > treepkg
view treepkg/info/package.py @ 579:97a5e09c84dc tip
Fix: pass url to command expand to be able to checkout a new git repository
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Sat, 03 Sep 2011 12:32:32 +0000 |
parents | 01c059298906 |
children |
line wrap: on
line source
# Copyright (C) 2010 by Intevation GmbH # Authors: # Bjoern Ricks <bjoern.ricks@intevation.de> # # This program is free software under the GPL (>=v2) # Read the file COPYING coming with the software for details. """Classes to read information from binary packages """ import os.path from treepkg import run from treepkg.cmdexpand import cmdexpand class DebianPackage: def __init__(self, filename): self.filename = filename def is_package(self): extension = os.path.splitext(self.filename)[1] return extension.lower() == ".deb" def get_architecture(self): if not self.is_package(): return None arch = run.capture_output(cmdexpand("dpkg-deb -f $debfile Architecture", debfile=self.filename)) return arch.strip() class BinaryPackage: def __init__(self, filename): self.filename = filename self.packagetypes = [] self.packagetypes.append(DebianPackage(self.filename)) def get_architecture(self): for packagetype in self.packagetypes: retval = packagetype.get_architecture() if not retval is None: return retval