mirror of
https://github.com/niess/python-appimage.git
synced 2026-03-14 04:10:15 +01:00
Catch Python 2.7 deprecation warning
This commit is contained in:
@@ -47,7 +47,7 @@ def ensure_appimagetool():
|
||||
with TemporaryDirectory() as tmpdir:
|
||||
urlretrieve(os.path.join(baseurl, appimage), appimage)
|
||||
os.chmod(appimage, stat.S_IRWXU)
|
||||
system('./' + appimage, '--appimage-extract')
|
||||
system(('./' + appimage, '--appimage-extract'))
|
||||
copy_tree('squashfs-root', appdir)
|
||||
|
||||
if not os.path.exists(APPIMAGETOOL):
|
||||
@@ -87,7 +87,7 @@ def ensure_patchelf():
|
||||
with TemporaryDirectory() as tmpdir:
|
||||
urlretrieve(os.path.join(baseurl, 'rolling', appimage), appimage)
|
||||
os.chmod(appimage, stat.S_IRWXU)
|
||||
system('./' + appimage, '--appimage-extract')
|
||||
system(('./' + appimage, '--appimage-extract'))
|
||||
copy_file('squashfs-root/usr/bin/patchelf', patchelf)
|
||||
os.chmod(patchelf, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ def docker_run(image, extra_cmds):
|
||||
raise ValueError('Unsupported Docker image: ' + image)
|
||||
|
||||
log('PULL', image)
|
||||
system('docker', 'pull', image)
|
||||
system(('docker', 'pull', image))
|
||||
|
||||
script = [
|
||||
'set -e',
|
||||
|
||||
@@ -9,20 +9,35 @@ from .log import debug
|
||||
__all__ = ['ldd', 'system']
|
||||
|
||||
|
||||
try:
|
||||
basestring
|
||||
except NameError:
|
||||
basestring = (str, bytes)
|
||||
|
||||
def system(*args):
|
||||
|
||||
def system(args, exclude=None):
|
||||
'''System call with capturing output
|
||||
'''
|
||||
cmd = ' '.join(args)
|
||||
debug('SYSTEM', cmd)
|
||||
|
||||
if exclude is None:
|
||||
exclude = []
|
||||
elif isinstance(exclude, basestring):
|
||||
exclude = [exclude]
|
||||
else:
|
||||
exclude = list(exclude)
|
||||
exclude.append('fuse: warning:')
|
||||
|
||||
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
if err:
|
||||
err = decode(err)
|
||||
stripped = [line for line in err.split(os.linesep)
|
||||
if line and not line.startswith('fuse: warning:')]
|
||||
stripped = [line for line in err.split(os.linesep) if line]
|
||||
for pattern in exclude:
|
||||
stripped = [line for line in stripped
|
||||
if not line.startswith(pattern)]
|
||||
if stripped:
|
||||
raise RuntimeError(err)
|
||||
|
||||
@@ -35,5 +50,5 @@ _ldd_pattern = re.compile('=> (.+) [(]0x')
|
||||
def ldd(path):
|
||||
'''Get dependencies list of dynamic libraries
|
||||
'''
|
||||
out = system('ldd', path)
|
||||
out = system(('ldd', path))
|
||||
return _ldd_pattern.findall(out)
|
||||
|
||||
Reference in New Issue
Block a user