status: make pep8 compliant
This commit is contained in:
parent
d6cd69e9d2
commit
67046842fe
1 changed files with 10 additions and 1 deletions
11
debarch.py
11
debarch.py
|
@ -19,10 +19,14 @@
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# 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_arch2tuple = None
|
||||||
_cached_tuple2arch = None
|
_cached_tuple2arch = None
|
||||||
_cached_cputable = None
|
_cached_cputable = None
|
||||||
|
|
||||||
|
|
||||||
def _load_table(path):
|
def _load_table(path):
|
||||||
table = []
|
table = []
|
||||||
with open(path, "r") as f:
|
with open(path, "r") as f:
|
||||||
|
@ -32,12 +36,14 @@ def _load_table(path):
|
||||||
table.append(line.split())
|
table.append(line.split())
|
||||||
return table
|
return table
|
||||||
|
|
||||||
|
|
||||||
def _read_cputable():
|
def _read_cputable():
|
||||||
global _cached_cputable
|
global _cached_cputable
|
||||||
if _cached_cputable is None:
|
if _cached_cputable is None:
|
||||||
_cached_cputable = _load_table('/usr/share/dpkg/cputable')
|
_cached_cputable = _load_table('/usr/share/dpkg/cputable')
|
||||||
return _cached_cputable
|
return _cached_cputable
|
||||||
|
|
||||||
|
|
||||||
def _read_tupletable():
|
def _read_tupletable():
|
||||||
global _cached_arch2tuple, _cached_tuple2arch
|
global _cached_arch2tuple, _cached_tuple2arch
|
||||||
if _cached_arch2tuple is None or _cached_tuple2arch is None:
|
if _cached_arch2tuple is None or _cached_tuple2arch is None:
|
||||||
|
@ -61,6 +67,7 @@ def _read_tupletable():
|
||||||
_cached_tuple2arch = tuple2arch
|
_cached_tuple2arch = tuple2arch
|
||||||
return _cached_tuple2arch, _cached_arch2tuple
|
return _cached_tuple2arch, _cached_arch2tuple
|
||||||
|
|
||||||
|
|
||||||
def debwildcard_to_debtuple(arch):
|
def debwildcard_to_debtuple(arch):
|
||||||
arch_tuple = arch.split('-', 3)
|
arch_tuple = arch.split('-', 3)
|
||||||
|
|
||||||
|
@ -76,6 +83,7 @@ def debwildcard_to_debtuple(arch):
|
||||||
else:
|
else:
|
||||||
return debarch_to_debtuple(arch)
|
return debarch_to_debtuple(arch)
|
||||||
|
|
||||||
|
|
||||||
def debarch_to_debtuple(arch):
|
def debarch_to_debtuple(arch):
|
||||||
if (arch.startswith("linux-")):
|
if (arch.startswith("linux-")):
|
||||||
arch = arch[6:]
|
arch = arch[6:]
|
||||||
|
@ -86,6 +94,7 @@ def debarch_to_debtuple(arch):
|
||||||
return
|
return
|
||||||
return tuple.split('-', 3)
|
return tuple.split('-', 3)
|
||||||
|
|
||||||
|
|
||||||
def match_architecture(real, alias):
|
def match_architecture(real, alias):
|
||||||
if alias == real or alias == "any":
|
if alias == real or alias == "any":
|
||||||
return True
|
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:
|
if real is None or len(real) != 4 or alias is None or len(alias) != 4:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
for i in range(0,4):
|
for i in range(0, 4):
|
||||||
if (alias[i] != real[i] and alias[i] != "any"):
|
if (alias[i] != real[i] and alias[i] != "any"):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue