From ad4f71fffa3de2f8ee262ef76f0e926068459d1d Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Fri, 21 Dec 2018 13:27:16 +0100 Subject: [bug] snap post install: add support to python2 Some old systems doesn't have python3 installed by default. Let's keep support for both python3 and python2 in our post installation script. `subprocess.run` doesn't exist on python2. - Resolves: #53 --- snap/pre/pack_installers | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'snap/pre') diff --git a/snap/pre/pack_installers b/snap/pre/pack_installers index c11bca8..a893574 100755 --- a/snap/pre/pack_installers +++ b/snap/pre/pack_installers @@ -27,7 +27,7 @@ with open(os.path.join(HELPDIR, POLKIT_FILE)) as polkit: b64_polkit = encode(polkit.read().encode()) with open(INSTALL, 'w') as install: - install.write('#!/usr/bin/env python3\n') + install.write('#!/usr/bin/env python\n') install.write('# DO NOT MODIFY MANUALLY\n') install.write('# This helper installs the polkit policy file\n') install.write('# for the RiseupVPN snap.\n') @@ -43,9 +43,10 @@ with open('/usr/share/polkit-1/actions/{polkit_file}', 'w') as polkit: for line in lines: polkit.write(line.decode() + "\\n") -release = subprocess.run(['cat', '/etc/os-release'], stdout=subprocess.PIPE).stdout +with open('/etc/os-release') as f: + release = f.read() # this is a workaround for the fact that debian does not place snap desktop entries in a system+wide path. -if b'ID=debian' in release: +if 'ID=debian' in release: cmd = 'ln -s /snap/{app_name}/current/snap/gui/{app_name}.desktop /usr/share/applications/' subprocess.run(cmd.split(' ')) subprocess.run(['update-desktop-database']) -- cgit v1.2.3