forked from Noethys/Noethys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
287 lines (234 loc) · 10.1 KB
/
setup.py
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#!\\usr\\bin\\env python
# -*- coding: iso-8859-15 -*-
#-----------------------------------------------------------
# Auteur: Ivan LUCAS
#-----------------------------------------------------------
import sys
import os
import glob
import os.path
import zipfile
import shutil
# Chemins
REP_COURANT = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, REP_COURANT)
NOETHYS_PATH = os.path.join(REP_COURANT, "noethys")
sys.path.insert(1, NOETHYS_PATH)
from setuptools import setup, find_packages
if "py2exe" in sys.argv :
import py2exe
import numpy
manifest = """
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="5.0.0.0"
processorArchitecture="x86"
name="Noethys"
type="win32"
/>
<description>Noethys</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false">
</requestedExecutionLevel>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.VC90.CRT"
version="9.0.21022.8"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b">
</assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
"""
def GetVersion():
""" Recherche du numéro de version """
fichierVersion = open(os.path.join(NOETHYS_PATH, "Versions.txt"), "r")
txtVersion = fichierVersion.readlines()[0]
fichierVersion.close()
pos_debut_numVersion = txtVersion.find("n")
pos_fin_numVersion = txtVersion.find("(")
numVersion = txtVersion[pos_debut_numVersion+1:pos_fin_numVersion].strip()
return numVersion
VERSION_APPLICATION = GetVersion()
options = {
"py2exe": {
"includes" : [
"matplotlib.backends",
"matplotlib.figure", "matplotlib.backends.backend_wxagg", "pylab", "numpy",
"email", "email.encoders", "email.generator", "email.iterators", "email.utils",
"email.mime.base", "email.mime.multipart", "email.mime.text",
"email.mime.image", "email.mime.audio", "email.base64mime",
"pyttsx.drivers.sapi5", "zope.interface", "mysql.connector.locales.eng.client_error"
],
'excludes' : [
'_gtkagg', '_tkagg', '_agg2', '_cairo', '_cocoaagg',
'_fltkagg', '_gtk', '_gtkcairo',
'backend_qt', 'backend_qt4', 'backend_qt4agg',
'backend_qtagg',
'backend_cairo', 'backend_cocoaagg',
'Tkconstants', 'Tkinter', 'tcl',
"_imagingtk", "PIL._imagingtk", "ImageTk", "PIL.ImageTk", "FixTk",
],
'dll_excludes': [
"tcl84.dll", "tk84.dll", "wxmsw26uh_vc.dll", "libgdk-win32-2.0-0.dll",
"libgobject-2.0-0.dll", "UxTheme.dll", "mswsock.dll", "powrprof.dll",
"msvcp90.dll", "msvcm90.dll",
"AVICAP32.dll", "AVIFIL32.dll", "MPR.dll", "MSACM32.dll", "MSVFW32.dll",
"KERNELBASE.dll", "crypt32.dll", "WLDAP32.dll",
"combase.dll", "dhcpcsvc.DLL",
"iertutil.dll", "IPHLPAPI.DLL", "NSI.dll", "OLEACC.dll",
"PSAPI.DLL", "Secur32.dll", "SETUPAPI.dll", "urlmon.dll",
"USERENV.dll", "USP10.dll", "WININET.dll", "WTSAPI32.dll",
"api-ms-win-core-delayload-l1-1-1.dll", "api-ms-win-core-heap-obsolete-l1-1-0.dll",
"api-ms-win-core-localization-obsolete-l1-2-0.dll", "api-ms-win-core-string-obsolete-l1-1-0.dll",
"api-ms-win-core-string-l1-1-0.dll", "api-ms-win-core-registry-l1-1-0.dll",
"api-ms-win-core-errorhandling-l1-1-1.dll", "api-ms-win-core-string-l2-1-0.dll",
"api-ms-win-core-profile-l1-1-0.dll", "api-ms-win*.dll",
"api-ms-win-core-processthreads-l1-1-2.dll", "api-ms-win-core-libraryloader-l1-2-1.dll",
"api-ms-win-core-file-l1-2-1.dll", "api-ms-win-security-base-l1-2-0.dll",
"api-ms-win-eventing-provider-l1-1-0.dll", "api-ms-win-core-heap-l2-1-0.dll",
"api-ms-win-core-libraryloader-l1-2-0.dll", "api-ms-win-core-localization-l1-2-1.dll",
"api-ms-win-core-sysinfo-l1-2-1.dll", "api-ms-win-core-synch-l1-2-0.dll",
"api-ms-win-core-heap-l1-2-0.dll", "api-ms-win-core-handle-l1-1-0.dll",
"api-ms-win-core-io-l1-1-1.dll", "api-ms-win-core-com-l1-1-1.dll",
"api-ms-win-core-memory-l1-1-2.dll", "api-ms-win-core-version-l1-1-1.dll",
"api-ms-win-core-version-l1-1-0.dll",
"numpy-atlas.dll",
],
"packages": [
"pytz", "reportlab", "twisted", "twisted.web.resource", "sqlalchemy",
"cffi", "cryptography", "lxml",
],
"typelibs": [
('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 4), # Pour Pyttsx - Version Windows 7
],
#'compressed' : 1 ,.
#'optimize': 2,
}
}
def GetDossiers(rep) :
listeFichiers = filter(os.path.isfile, glob.glob(os.path.join("noethys", rep, "*")))
return rep, listeFichiers
data_files=[
# Images
GetDossiers("Static/Images/16x16"),
GetDossiers("Static/Images/22x22"),
GetDossiers("Static/Images/32x32"),
GetDossiers("Static/Images/48x48"),
GetDossiers("Static/Images/80x80"),
GetDossiers("Static/Images/128x128"),
GetDossiers("Static/Images/BoutonsImages"),
GetDossiers("Static/Images/Drapeaux"),
GetDossiers("Static/Images/Special"),
GetDossiers("Static/Images/Badgeage"),
GetDossiers("Static/Images/Menus"),
GetDossiers("Static/Images/Teamword"),
GetDossiers("Static/Images/Avatars/16x16"),
GetDossiers("Static/Images/Avatars/128x128"),
GetDossiers("Static/Images/Interface/Vert"),
GetDossiers("Static/Images/Interface/Bleu"),
GetDossiers("Static/Images/Interface/Noir"),
# Databases
GetDossiers("Static/Databases"),
# Divers
GetDossiers("Static/Divers"),
# Exemples
GetDossiers("Static/Exemples"),
# Lang
GetDossiers("Static/Lang"),
# Polices
GetDossiers("Static/Polices"),
# Fichiers à importer :
('', ['noethys/Versions.txt', 'noethys/Licence.txt', 'noethys/Icone.ico']),
]
# Autres data_files
if "py2exe" in sys.argv :
# Ajoute les fichiers de Matplotlib
import matplotlib as mp
matplotlib_font_afm = glob.glob(os.sep.join([mp.get_data_path(), 'fonts\\afm\\*']))
matplotlib_font_pdfcorefonts = glob.glob(os.sep.join([mp.get_data_path(), 'fonts\\pdfcorefonts\\*']))
matplotlib_font_ttf = glob.glob(os.sep.join([mp.get_data_path(), 'fonts\\ttf\\*']))
matplotlib_images = glob.glob(os.sep.join([mp.get_data_path(), 'images\\*']))
data_files += mp.get_py2exe_datafiles()
# Ajoute les fichiers Windows
data_files.append(('', ['noethys/msvcm90.dll', 'noethys/msvcp90.dll', 'noethys/msvcr90.dll', 'noethys/Microsoft.VC90.CRT.manifest', 'noethys/gdiplus.dll', ]))
setup(
name = "Noethys",
version = VERSION_APPLICATION,
author = "Ivan LUCAS",
description = u"Noethys, le logiciel libre et gratuit de gestion multi-activités",
long_description = open("README.md").read().decode("iso-8859-15"),
url = "http://www.noethys.com",
license = "GPL V3",
plateformes = "ALL",
classifiers = [ "Topic :: Office/Business",
"Topic :: Education"
"Topic :: Utilities"],
options = options,
data_files = data_files,
#dependency_links = [],
packages = ["noethys", "noethys.Ctrl", "noethys.Data", "noethys.Dlg", "noethys.ObjectListView", "noethys.Ol", "noethys.Outils", "noethys.Utils"],
install_requires = open("requirements.txt").readlines(),
windows = [
{
"script" : "noethys/Noethys.py",
"icon_resources" : [(1, "noethys/Icone.ico")],
"other_resources": [(24,1, manifest)]
}
],)
# Insertions manuelles dans le ZIP
if "py2exe" in sys.argv :
z = zipfile.ZipFile(os.path.join("dist/", "library.zip"), 'a')
# IMPORTANT : Ce code ne fonctione que si Pytz est unzippé :
# Commande easy_install --upgrade --always-unzip pytz
# Pour la mettre à jour avec un dézippe automatique
# Timezone de pytz :
print "Ajout manuel du repertoire Zoneinfo de pytz..."
import pytz
zoneinfo_dir = os.path.join(os.path.dirname(pytz.__file__), 'zoneinfo')
disk_basedir = os.path.dirname(os.path.dirname(pytz.__file__))
for absdir, directories, filenames in os.walk(zoneinfo_dir):
assert absdir.startswith(disk_basedir), (absdir, disk_basedir)
zip_dir = absdir[len(disk_basedir):]
for f in filenames:
z.write(os.path.join(absdir, f), os.path.join(zip_dir, f))
# Typelibs Microsoft Speech pour Windows XP
print "Ajout manuel du Typelibs Microsoft Speech pour Windows XP..."
nom = "C866CA3A-32F7-11D2-9602-00C04F8EE628x0x5x0.py"
z.write("noethys/Outils/%s" % nom, "win32com/gen_py/%s" % nom)
# Importe le cacert.pem dans le répertoire certifi
import certifi
chemin_cert = certifi.where()
z.write(chemin_cert, "certifi/cacert.pem")
# Cloture le ZIP
z.close()
# Supprime le répertoire des données exemples de Matplotlib
print "Supprime les donnees exemples de Matplotlib si besoin..."
try :
shutil.rmtree("dist/mpl-data/sample_data")
except :
pass
print "Fini !"