Browse Source

First package version

Daniel Berteaud 3 months ago
parent
commit
c0b0235183
4 changed files with 413 additions and 0 deletions
  1. 32
    0
      WAPT/control
  2. 295
    0
      WAPT/wapt.psproj
  3. 20
    0
      extensions.rdf.j2
  4. 66
    0
      setup.py

+ 32
- 0
WAPT/control View File

@@ -0,0 +1,32 @@
1
+package           : fws-sogo-addons
2
+version           : 1
3
+architecture      : all
4
+section           : base
5
+priority          : optional
6
+maintainer        : Daniel Berteaud <daniel@firewall-services.com>
7
+description       : SOGo addons for Thunderbird
8
+depends           : fws-thunderbird, fws-7zip
9
+conflicts         : 
10
+maturity          : DEV
11
+locale            : 
12
+target_os         : windows
13
+min_os_version    : 
14
+max_os_version    : 
15
+min_wapt_version  : 
16
+sources           : 
17
+installed_size    : 
18
+impacted_process  : 
19
+description_fr    : 
20
+description_pl    : 
21
+description_de    : 
22
+description_es    : 
23
+audit_schedule    : 4w
24
+editor            : 
25
+keywords          : 
26
+licence           : 
27
+homepage          : 
28
+package_uuid      : 
29
+signer            : 
30
+signer_fingerprint: 
31
+signature_date    : 
32
+signed_attributes : 

+ 295
- 0
WAPT/wapt.psproj View File

@@ -0,0 +1,295 @@
1
+[PyScripter]
2
+Version=3.3.2.0
3
+
4
+[Project]
5
+ClassName=TProjectRootNode
6
+StoreRelativePaths=TRUE
7
+ShowFileExtensions=FALSE
8
+
9
+[Project\ChildNodes\Node0]
10
+ClassName=TProjectFilesNode
11
+
12
+[Project\ChildNodes\Node0\ChildNodes\Node0]
13
+ClassName=TProjectFolderNode
14
+Name=wapt
15
+
16
+[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node0]
17
+ClassName=TProjectFileNode
18
+FileName=C:\Program Files (x86)\wapt\common.py
19
+
20
+[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node1]
21
+ClassName=TProjectFileNode
22
+FileName=C:\Program Files (x86)\wapt\setuphelpers.py
23
+
24
+[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node2]
25
+ClassName=TProjectFileNode
26
+FileName=C:\Program Files (x86)\wapt\wapt-get.ini
27
+
28
+[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node3]
29
+ClassName=TProjectFileNode
30
+FileName=C:\Program Files (x86)\wapt\wapt-get.py
31
+
32
+[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes\Node4]
33
+ClassName=TProjectFileNode
34
+FileName=C:\Program Files (x86)\wapt\waptpackage.py
35
+
36
+[Project\ChildNodes\Node0\ChildNodes\Node0\ChildNodes]
37
+Count=5
38
+
39
+[Project\ChildNodes\Node0\ChildNodes\Node1]
40
+ClassName=TProjectFileNode
41
+FileName=$[Project-Path]changelog.txt
42
+
43
+[Project\ChildNodes\Node0\ChildNodes\Node2]
44
+ClassName=TProjectFileNode
45
+FileName=$[Project-Path]control
46
+
47
+[Project\ChildNodes\Node0\ChildNodes\Node3]
48
+ClassName=TProjectFileNode
49
+FileName=$[Project-Path]..\setup.py
50
+
51
+[Project\ChildNodes\Node0\ChildNodes]
52
+Count=4
53
+
54
+[Project\ChildNodes\Node1]
55
+ClassName=TProjectRunConfiguationsNode
56
+
57
+[Project\ChildNodes\Node1\ChildNodes\Node0]
58
+ClassName=TProjectRunConfiguationNode
59
+Name=install
60
+
61
+[Project\ChildNodes\Node1\ChildNodes\Node0\RunConfig]
62
+ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
63
+EngineType=peRemote
64
+ReinitializeBeforeRun=TRUE
65
+Parameters=install "$[Project-Path].."
66
+WorkingDir=$[Project-Path]..
67
+WriteOutputToFile=FALSE
68
+OutputFileName=$[ActiveScript-NoExt].log
69
+AppendToFile=FALSE
70
+
71
+[Project\ChildNodes\Node1\ChildNodes\Node0\RunConfig\ExternalRun]
72
+Caption=External Run
73
+Description=Run script using an external Python Interpreter
74
+ApplicationName=$[PythonExe-Short]
75
+Parameters=$[ActiveScript-Short]
76
+WorkingDirectory=$[ActiveScript-Dir]
77
+ShortCut=0
78
+MessagesFormat=$[FileName] $[LineNumber]
79
+
80
+[Project\ChildNodes\Node1\ChildNodes\Node1]
81
+ClassName=TProjectRunConfiguationNode
82
+Name=remove
83
+
84
+[Project\ChildNodes\Node1\ChildNodes\Node1\RunConfig]
85
+ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
86
+EngineType=peRemote
87
+ReinitializeBeforeRun=TRUE
88
+Parameters=remove "$[Project-Path].."
89
+WorkingDir=$[Project-Path]..
90
+WriteOutputToFile=FALSE
91
+OutputFileName=$[ActiveScript-NoExt].log
92
+AppendToFile=FALSE
93
+
94
+[Project\ChildNodes\Node1\ChildNodes\Node1\RunConfig\ExternalRun]
95
+Caption=External Run
96
+Description=Run script using an external Python Interpreter
97
+ApplicationName=$[PythonExe-Short]
98
+Parameters=$[ActiveScript-Short]
99
+WorkingDirectory=$[ActiveScript-Dir]
100
+ShortCut=0
101
+MessagesFormat=$[FileName] $[LineNumber]
102
+
103
+[Project\ChildNodes\Node1\ChildNodes\Node2]
104
+ClassName=TProjectRunConfiguationNode
105
+Name=session-setup
106
+
107
+[Project\ChildNodes\Node1\ChildNodes\Node2\RunConfig]
108
+ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
109
+EngineType=peRemote
110
+ReinitializeBeforeRun=TRUE
111
+Parameters=session-setup "$[Project-Path].."
112
+WorkingDir=$[Project-Path]..
113
+WriteOutputToFile=FALSE
114
+OutputFileName=$[ActiveScript-NoExt].log
115
+AppendToFile=FALSE
116
+
117
+[Project\ChildNodes\Node1\ChildNodes\Node2\RunConfig\ExternalRun]
118
+Caption=External Run
119
+Description=Run script using an external Python Interpreter
120
+ApplicationName=$[PythonExe-Short]
121
+Parameters=$[ActiveScript-Short]
122
+WorkingDirectory=$[ActiveScript-Dir]
123
+ShortCut=0
124
+MessagesFormat=$[FileName] $[LineNumber]
125
+
126
+[Project\ChildNodes\Node1\ChildNodes\Node3]
127
+ClassName=TProjectRunConfiguationNode
128
+Name=update
129
+
130
+[Project\ChildNodes\Node1\ChildNodes\Node3\RunConfig]
131
+ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
132
+EngineType=peRemote
133
+ReinitializeBeforeRun=TRUE
134
+Parameters=update
135
+WorkingDir=$[Project-Path]..
136
+WriteOutputToFile=FALSE
137
+OutputFileName=$[ActiveScript-NoExt].log
138
+AppendToFile=FALSE
139
+
140
+[Project\ChildNodes\Node1\ChildNodes\Node3\RunConfig\ExternalRun]
141
+Caption=External Run
142
+Description=Run script using an external Python Interpreter
143
+ApplicationName=$[PythonExe-Short]
144
+Parameters=$[ActiveScript-Short]
145
+WorkingDirectory=$[ActiveScript-Dir]
146
+ShortCut=0
147
+MessagesFormat=$[FileName] $[LineNumber]
148
+
149
+[Project\ChildNodes\Node1\ChildNodes\Node4]
150
+ClassName=TProjectRunConfiguationNode
151
+Name=upgrade
152
+
153
+[Project\ChildNodes\Node1\ChildNodes\Node4\RunConfig]
154
+ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
155
+EngineType=peRemote
156
+ReinitializeBeforeRun=TRUE
157
+Parameters=-f upgrade
158
+WorkingDir=$[ActiveScript-Dir]
159
+WriteOutputToFile=FALSE
160
+OutputFileName=$[ActiveScript-NoExt].log
161
+AppendToFile=FALSE
162
+
163
+[Project\ChildNodes\Node1\ChildNodes\Node4\RunConfig\ExternalRun]
164
+Caption=External Run
165
+Description=Run script using an external Python Interpreter
166
+ApplicationName=$[PythonExe-Short]
167
+Parameters=$[ActiveScript-Short]
168
+WorkingDirectory=$[ActiveScript-Dir]
169
+ShortCut=0
170
+MessagesFormat=$[FileName] $[LineNumber]
171
+
172
+[Project\ChildNodes\Node1\ChildNodes\Node5]
173
+ClassName=TProjectRunConfiguationNode
174
+Name=-i build-upload
175
+
176
+[Project\ChildNodes\Node1\ChildNodes\Node5\RunConfig]
177
+ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
178
+EngineType=peRemote
179
+ReinitializeBeforeRun=TRUE
180
+Parameters=-i build-upload "$[Project-Path].."
181
+WorkingDir=$[Project-Path]..
182
+WriteOutputToFile=FALSE
183
+OutputFileName=$[ActiveScript-NoExt].log
184
+AppendToFile=FALSE
185
+
186
+[Project\ChildNodes\Node1\ChildNodes\Node5\RunConfig\ExternalRun]
187
+Caption=External Run
188
+Description=Run script using an external Python Interpreter
189
+ApplicationName=$[PythonExe-Short]
190
+Parameters=$[ActiveScript-Short]
191
+WorkingDirectory=$[ActiveScript-Dir]
192
+ShortCut=0
193
+MessagesFormat=$[FileName] $[LineNumber]
194
+
195
+[Project\ChildNodes\Node1\ChildNodes\Node6]
196
+ClassName=TProjectRunConfiguationNode
197
+Name=svn update
198
+
199
+[Project\ChildNodes\Node1\ChildNodes\Node6\RunConfig]
200
+ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
201
+EngineType=peRemote
202
+ReinitializeBeforeRun=TRUE
203
+Parameters=sources "$[Project-Path].."
204
+WorkingDir=$[Project-Path]..
205
+WriteOutputToFile=FALSE
206
+OutputFileName=$[ActiveScript-NoExt].log
207
+AppendToFile=FALSE
208
+
209
+[Project\ChildNodes\Node1\ChildNodes\Node6\RunConfig\ExternalRun]
210
+Caption=External Run
211
+Description=Run script using an external Python Interpreter
212
+ApplicationName=$[PythonExe-Short]
213
+Parameters=$[ActiveScript-Short]
214
+WorkingDirectory=$[ActiveScript-Dir]
215
+ShortCut=0
216
+MessagesFormat=$[FileName] $[LineNumber]
217
+
218
+[Project\ChildNodes\Node1\ChildNodes\Node7]
219
+ClassName=TProjectRunConfiguationNode
220
+Name=uninstall
221
+
222
+[Project\ChildNodes\Node1\ChildNodes\Node7\RunConfig]
223
+ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
224
+EngineType=peRemote
225
+ReinitializeBeforeRun=TRUE
226
+Parameters=uninstall "$[Project-Path].."
227
+WorkingDir=$[Project-Path]..
228
+WriteOutputToFile=FALSE
229
+OutputFileName=$[ActiveScript-NoExt].log
230
+AppendToFile=FALSE
231
+
232
+[Project\ChildNodes\Node1\ChildNodes\Node7\RunConfig\ExternalRun]
233
+Caption=External Run
234
+Description=Run script using an external Python Interpreter
235
+ApplicationName=$[PythonExe-Short]
236
+Parameters=$[ActiveScript-Short]
237
+WorkingDirectory=$[Project-Path]..
238
+ShortCut=0
239
+MessagesFormat=$[FileName] $[LineNumber]
240
+
241
+[Project\ChildNodes\Node1\ChildNodes\Node8]
242
+ClassName=TProjectRunConfiguationNode
243
+Name=update-package-sources
244
+
245
+[Project\ChildNodes\Node1\ChildNodes\Node8\RunConfig]
246
+ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
247
+EngineType=peRemote
248
+ReinitializeBeforeRun=TRUE
249
+Parameters=update-package-sources "$[Project-Path].."
250
+WorkingDir=$[Project-Path]..
251
+WriteOutputToFile=FALSE
252
+OutputFileName=$[ActiveScript-NoExt].log
253
+AppendToFile=FALSE
254
+
255
+[Project\ChildNodes\Node1\ChildNodes\Node8\RunConfig\ExternalRun]
256
+Caption=External Run
257
+Description=Run script using an external Python Interpreter
258
+ApplicationName=$[PythonExe-Short]
259
+Parameters=$[ActiveScript-Short]
260
+WorkingDirectory=$[ActiveScript-Dir]
261
+ShortCut=0
262
+MessagesFormat=$[FileName] $[LineNumber]
263
+
264
+[Project\ChildNodes\Node1\ChildNodes\Node9]
265
+ClassName=TProjectRunConfiguationNode
266
+Name=audit
267
+
268
+[Project\ChildNodes\Node1\ChildNodes\Node9\RunConfig]
269
+ScriptName=C:\Program Files (x86)\wapt\wapt-get.py
270
+EngineType=peRemote
271
+ReinitializeBeforeRun=TRUE
272
+Parameters=audit "$[Project-Path].."
273
+WorkingDir=$[Project-Path]..
274
+WriteOutputToFile=FALSE
275
+OutputFileName=$[ActiveScript-NoExt].log
276
+AppendToFile=FALSE
277
+
278
+[Project\ChildNodes\Node1\ChildNodes\Node9\RunConfig\ExternalRun]
279
+Caption=External Run
280
+Description=Run script using an external Python Interpreter
281
+ApplicationName=$[PythonExe-Short]
282
+Parameters=$[ActiveScript-Short]
283
+WorkingDirectory=$[ActiveScript-Dir]
284
+ShortCut=0
285
+MessagesFormat=$[FileName] $[LineNumber]
286
+
287
+[Project\ChildNodes\Node1\ChildNodes]
288
+Count=10
289
+
290
+[Project\ChildNodes]
291
+Count=2
292
+
293
+[Project\ExtraPythonPath]
294
+Count=0
295
+

+ 20
- 0
extensions.rdf.j2 View File

@@ -0,0 +1,20 @@
1
+<?xml version="1.0"?>
2
+<!DOCTYPE RDF>
3
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
4
+  xmlns:isi="http://inverse.ca/sogo-integrator/"
5
+  xmlns:em="http://www.mozilla.org/2004/em-rdf#"
6
+  xmlns:NC="http://home.netscape.com/NC-rdf#">
7
+  <Seq about="http://inverse.ca/sogo-integrator/extensions"
8
+    isi:updateURL="https://{{ sogo_server }}/plugins/updates.php?plugin=%ITEM_ID%&amp;version=%ITEM_VERSION%&amp;platform=%PLATFORM%">
9
+    <li>
10
+      <Description
11
+        em:id="sogo-integrator@inverse.ca"
12
+        em:name="SOGo Integrator"/>
13
+    </li>
14
+    <li>
15
+      <Description
16
+        em:id="sogo-connector@inverse.ca"
17
+        em:name="SOGo Connector"/>
18
+    </li>
19
+  </Seq>
20
+</RDF>

+ 66
- 0
setup.py View File

@@ -0,0 +1,66 @@
1
+# -*- coding: UTF-8 -*-
2
+from setuphelpers import *
3
+import json
4
+from cryptography.fernet import Fernet
5
+import os
6
+from jinja2 import Environment, FileSystemLoader
7
+
8
+uninstallkey = []
9
+
10
+variables = {
11
+    'sogo_server': 'mail.server.local'
12
+}
13
+
14
+# Read local variables file if available
15
+if isfile(makepath(programfiles32,'wapt','private','symetric.txt')) and isfile(makepath(programfiles32,'wapt','private','variables.txt')):
16
+    print('Reading local encrypted variables file')
17
+    f = Fernet(open(makepath(programfiles32,'wapt','private','symetric.txt'),'r').read())
18
+    variables.update(json.loads(f.decrypt(open(makepath(programfiles32,'wapt','private','variables.txt'),'r').read())))
19
+
20
+install_dir = programfiles
21
+if iswin64():
22
+    install_dir = programfiles32
23
+connector_version = '60.0.0'
24
+integrator_version = '60.0.0'
25
+
26
+def install():
27
+    for extension in ['connector','integrator']:
28
+        if not isdir(makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-' + extension)):
29
+            mkdirs(makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-' + extension))
30
+
31
+    # connector can be extracted as is
32
+    run('"%s" x -y -o"%s" sogo-connector-%s.xpi' % (makepath(programfiles,'7-Zip','7z.exe'), makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-connector'), connector_version))
33
+
34
+    # Integrator must be customized, so first extract it
35
+    run('"%s" x -y -o"%s" sogo-integrator-%s-sogo-demo.xpi' % (makepath(programfiles,'7-Zip','7z.exe'), makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-integrator'), integrator_version))
36
+    # And replace the extensions.rdf content
37
+    jinja2 = Environment(
38
+        loader=FileSystemLoader(os.path.dirname(os.path.abspath(__file__))),
39
+        trim_blocks=True
40
+    )
41
+    open(makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-integrator','chrome','content','extensions.rdf'),'w').write(
42
+        jinja2.get_template('extensions.rdf.j2').render(
43
+            sogo_server = variables['sogo_server']
44
+        )
45
+    )
46
+    # Also remove custom settings
47
+    os.unlink(makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-integrator','defaults','preferences','site.js'))
48
+
49
+
50
+def uninstall():
51
+    print('Removing SOGo extensions for Thunderbird')
52
+    for extension in ['connector','integrator']:
53
+        remove_tree(makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-' + extension))
54
+
55
+def audit():
56
+    try:
57
+        run('type "%s" | find /I "em:version=" | find "%s"' % (makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-connector','install.rdf'), connector_version))
58
+    except:
59
+        print('SOGO connector version check failed')
60
+        return "ERROR"
61
+    try:
62
+        run('type "%s" | find /I "em:version=" | find "%s"' % (makepath(install_dir,'Mozilla Thunderbird','distribution','bundles','sogo-integrator','install.rdf'), integrator_version))
63
+    except:
64
+        print('SOGO integrator version check failed')
65
+        return "ERROR"
66
+    return "OK"

Loading…
Cancel
Save