-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcanaille.spec
112 lines (92 loc) · 2.68 KB
/
canaille.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# -*- mode: python ; coding: utf-8 -*-
import os
import re
from pathlib import Path
import importlib.resources
from canaille.app.i18n import available_language_codes
from canaille import create_app
with create_app({"SECRET_KEY": "foo"}).app_context():
codes = available_language_codes()
with importlib.resources.path('wtforms', 'locale') as locale_path:
wtforms_locale = str(locale_path)
def filter_wtforms_catalogs(item):
dest, _, _ = item
if not dest.startswith("wtforms/locale"):
return True
if Path(dest).suffix != ".mo":
return False
code = dest.split("/")[2][:2]
return code in codes
def filter_babel_catalogs(item):
dest, _, _ = item
if not re.match(r"babel/locale-data/\w+\.dat", dest):
return True
code = Path(dest).stem[:2]
return code in codes
def filter_pycountry_catalogs(item):
dest, _, _ = item
if not re.match(r"pycountry/locales/\w+/LC_MESSAGES/.+\.mo", dest):
return True
code = dest.split("/")[2][:2]
return code in codes
def filter_map_files(item):
dest, _, _ = item
return not dest.endswith(".map")
def filter_faker_providers(item):
dest, _, _ = item
if not re.match(r"faker/providers/\w+/\w+", dest):
return True
code = dest.split("/")[3][:2]
return code in codes
a = Analysis(
['canaille/commands.py'],
pathex=[],
binaries=[],
datas = [
('canaille/backends/sql/migrations', 'canaille/backends/sql/migrations'),
('canaille/templates', 'canaille/templates'),
('canaille/static', 'canaille/static'),
(wtforms_locale, 'wtforms/locale'),
],
hiddenimports=[
"canaille.app.server",
"canaille.backends.memory.backend",
"canaille.backends.sql.backend",
"canaille.backends.ldap.backend",
# TODO: import all passlib handlers?
"passlib.hash",
"passlib.handlers.pbkdf2",
],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=1,
)
pyz = PYZ(a.pure)
a.datas = list(filter(filter_wtforms_catalogs, a.datas))
a.datas = list(filter(filter_babel_catalogs, a.datas))
a.datas = list(filter(filter_pycountry_catalogs, a.datas))
a.datas = list(filter(filter_faker_providers, a.datas))
a.datas = list(filter(filter_map_files, a.datas))
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='canaille',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)