Add an app builder

This commit is contained in:
Valentin Niess
2020-04-02 00:10:20 +02:00
parent 83ee9e5f0c
commit f23a2dc25f
10 changed files with 320 additions and 42 deletions

View File

@@ -2,20 +2,13 @@ import os
import re
import subprocess
from .compat import decode
from .log import debug
__all__ = ['ldd', 'system']
def _decode(s):
'''Decode Python 3 bytes as str
'''
try:
return s.decode()
except AttributeError:
return s
def system(*args):
'''System call with capturing output
@@ -27,13 +20,13 @@ def system(*args):
stderr=subprocess.PIPE)
out, err = p.communicate()
if err:
err = _decode(err)
err = decode(err)
stripped = [line for line in err.split(os.linesep)
if line and not line.startswith('fuse: warning:')]
if stripped:
raise RuntimeError(err)
return str(_decode(out).strip())
return str(decode(out).strip())
_ldd_pattern = re.compile('=> (.+) [(]0x')