Use YAML formatted variable file
This commit is contained in:
parent
fd692fce9e
commit
e5803c65f2
|
@ -1,5 +1,5 @@
|
|||
package : fws-thunderbird-config
|
||||
version : 6
|
||||
version : 7
|
||||
architecture : all
|
||||
section : base
|
||||
priority : optional
|
||||
|
|
14
setup.py
14
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,8 +12,10 @@ 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 Thunderbird','defaults','pref'))
|
||||
|
@ -23,7 +23,7 @@ def install():
|
|||
mkdirs(makepath(programfiles, 'Mozilla Thunderbird','chrome'))
|
||||
filecopyto('custom-strings.txt', makepath(programfiles,'Mozilla Thunderbird','chrome'))
|
||||
jinja2 = Environment(
|
||||
loader=FileSystemLoader(os.path.dirname(os.path.abspath(__file__))),
|
||||
loader=FileSystemLoader(os.getcwd()),
|
||||
trim_blocks=True
|
||||
)
|
||||
open(makepath(programfiles,'Mozilla Thunderbird','thunderbird.cfg'),'w').write(
|
||||
|
@ -34,9 +34,9 @@ def install():
|
|||
)
|
||||
|
||||
def uninstall():
|
||||
os.unlink(makepath(programfiles,'Mozilla Thunderbird','defaults','pref','autoconf.js'))
|
||||
os.unlink(makepath(programfiles,'Mozilla Thunderbird','chrome','custom-strings.txt'))
|
||||
os.unlink(makepath(programfiles,'Mozilla Thunderbird','thunderbird.cfg'))
|
||||
remove_file(makepath(programfiles,'Mozilla Thunderbird','defaults','pref','autoconf.js'))
|
||||
remove_file(makepath(programfiles,'Mozilla Thunderbird','chrome','custom-strings.txt'))
|
||||
remove_file(makepath(programfiles,'Mozilla Thunderbird','thunderbird.cfg'))
|
||||
|
||||
def audit():
|
||||
if (
|
||||
|
|
Loading…
Reference in New Issue