From 1cd6b61c3dc2eb92ca39cadb9cff23bbe355d117 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Thu, 20 Dec 2018 13:15:20 +0100 Subject: [PATCH] Use YAML formatted variable file --- WAPT/control | 2 +- setup.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/WAPT/control b/WAPT/control index c946374..824df9f 100644 --- a/WAPT/control +++ b/WAPT/control @@ -1,5 +1,5 @@ package : fws-firefox-config -version : 4 +version : 5 architecture : all section : base priority : optional diff --git a/setup.py b/setup.py index 403123c..9320f63 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,5 @@ # -*- coding: utf-8 -*- from setuphelpers import * -import json -from cryptography.fernet import Fernet import os from jinja2 import Environment, FileSystemLoader @@ -14,14 +12,16 @@ variables = { # Read local variables file if available if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')): print('Reading local encrypted variables file') + from cryptography.fernet import Fernet + import yaml f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read()) - variables.update(json.loads(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read()))) + variables.update(yaml.safe_load(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read()))) def install(): filecopyto('autoconf.js',makepath(programfiles,'Mozilla Firefox','defaults','pref')) filecopyto('override.ini',makepath(programfiles,'Mozilla Firefox')) jinja2 = Environment( - loader=FileSystemLoader(os.path.dirname(os.path.abspath(__file__))), + loader=FileSystemLoader(os.getcwd()), trim_blocks=True ) open(makepath(programfiles,'Mozilla Firefox','firefox.cfg'),'w').write( @@ -32,9 +32,9 @@ def install(): ) def uninstall(): - os.unlink(makepath(programfiles,'Mozilla Firefox','defaults','pref','autoconf.js')) - os.unlink(makepath(programfiles,'Mozilla Firefox','override.ini')) - os.unlink(makepath(programfiles,'Mozilla Firefox','firefox.cfg')) + remove_file(makepath(programfiles,'Mozilla Firefox','defaults','pref','autoconf.js')) + remove_file(makepath(programfiles,'Mozilla Firefox','override.ini')) + remove_file(makepath(programfiles,'Mozilla Firefox','firefox.cfg')) def audit(): if (