Use YAML formatted variable file

master
Daniel Berteaud 6 years ago
parent 8fb293d0a5
commit 1cd6b61c3d
  1. 2
      WAPT/control
  2. 14
      setup.py

@ -1,5 +1,5 @@
package : fws-firefox-config
version : 4
version : 5
architecture : all
section : base
priority : optional

@ -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 (

Loading…
Cancel
Save