diff --git a/debarch.py b/debarch.py index b613d8f..aa97a4f 100644 --- a/debarch.py +++ b/debarch.py @@ -19,10 +19,14 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# FIXME: this should be integrated into python-debian +# see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771058 + _cached_arch2tuple = None _cached_tuple2arch = None _cached_cputable = None + def _load_table(path): table = [] with open(path, "r") as f: @@ -32,12 +36,14 @@ def _load_table(path): table.append(line.split()) return table + def _read_cputable(): global _cached_cputable if _cached_cputable is None: _cached_cputable = _load_table('/usr/share/dpkg/cputable') return _cached_cputable + def _read_tupletable(): global _cached_arch2tuple, _cached_tuple2arch if _cached_arch2tuple is None or _cached_tuple2arch is None: @@ -61,6 +67,7 @@ def _read_tupletable(): _cached_tuple2arch = tuple2arch return _cached_tuple2arch, _cached_arch2tuple + def debwildcard_to_debtuple(arch): arch_tuple = arch.split('-', 3) @@ -76,6 +83,7 @@ def debwildcard_to_debtuple(arch): else: return debarch_to_debtuple(arch) + def debarch_to_debtuple(arch): if (arch.startswith("linux-")): arch = arch[6:] @@ -86,6 +94,7 @@ def debarch_to_debtuple(arch): return return tuple.split('-', 3) + def match_architecture(real, alias): if alias == real or alias == "any": return True @@ -96,7 +105,7 @@ def match_architecture(real, alias): if real is None or len(real) != 4 or alias is None or len(alias) != 4: return False - for i in range(0,4): + for i in range(0, 4): if (alias[i] != real[i] and alias[i] != "any"): return False return True