forked from reingart/pyafipws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
425 lines (375 loc) · 15.7 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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
#!/usr/bin/python
# -*- coding: latin-1 -*-
# Para hacer el ejecutable:
# python setup.py py2exe
#
"Creador de instalador para PyAfipWs"
__author__ = "Mariano Reingart ([email protected])"
__copyright__ = "Copyright (C) 2008-2013 Mariano Reingart"
from __init__ import __version__
from distutils.core import setup
import glob
import os
import sys
# modulos a compilar y empaquetar (comentar si no se desea incluir):
#import pyafipws
#import pyrece
#import wsaa
#import wsfev1, rece1
#import wsfexv1, recex1
#import wsbfev1, receb1
#import wsmtx, recem
#import pyfepdf
#import pyemail
#import pyi25
#import wsctgv2
#import wslpg
#import wscoc
#import wscdc
#import cot
import trazamed
#import trazarenpre
#import trazafito
#import padron
# herramientas opcionales a compilar y empaquetar:
try:
if 'pyfepdf' in globals() or 'pyrece' in globals():
import designer
except ImportError:
# el script pyfpdf/tools/designer.py no esta disponible:
print "IMPORTANTE: no se incluye el diseñador de plantillas PDF"
# parametros para setup:
kwargs = {}
long_desc = ("Interfases, herramientas y aplicativos para Servicios Web"
"AFIP (Factura Electrónica, Granos, Aduana, etc.), "
"ANMAT (Trazabilidad de Medicamentos), "
"RENPRE (Trazabilidad de Precursores Químicos), "
"ARBA (Remito Electrónico)")
data_files = [
(".", ["licencia.txt",]),
("conf", ["conf/rece.ini", "conf/geotrust.crt", "conf/afip_ca_info.crt", ]),
("cache", glob.glob("cache/*")),
]
HOMO = True
# build a one-click-installer for windows:
if 'py2exe' in sys.argv:
import py2exe
from nsis import build_installer, Target
# includes for py2exe
includes=['email.generator', 'email.iterators', 'email.message', 'email.utils', 'email.mime.text', 'email.mime.application', 'email.mime.multipart']
# optional modules:
# required modules for shelve support (not detected by py2exe by default):
for mod in ['socks', 'dbhash', 'gdbm', 'dbm', 'dumbdbm', 'anydbm']:
try:
__import__(mod)
includes.append(mod)
except ImportError:
pass
# don't pull in all this MFC stuff used by the makepy UI.
excludes=["pywin", "pywin.dialogs", "pywin.dialogs.list", "win32ui",
"Tkconstants","Tkinter","tcl",
"_imagingtk", "PIL._imagingtk", "ImageTk", "PIL.ImageTk", "FixTk",
]
# basic options for py2exe
opts = {
'py2exe': {
'includes': includes,
'optimize': 0,
'excludes': excludes,
'dll_excludes': ["mswsock.dll", "powrprof.dll", "KERNELBASE.dll",
"API-MS-Win-Core-LocalRegistry-L1-1-0.dll",
"API-MS-Win-Core-ProcessThreads-L1-1-0.dll",
"API-MS-Win-Security-Base-L1-1-0.dll"
],
'skip_archive': True,
}
}
desc = "Instalador PyAfipWs"
kwargs['com_server'] = []
kwargs['console'] = []
kwargs['windows'] = []
# add 32bit or 64bit tag to the installer name
import platform
__version__ += "-" + platform.architecture()[0]
# legacy webservices & utilities:
if 'pyafipws' in globals():
kwargs['com_server'] += ["pyafipws"]
kwargs['console'] += ['rece.py', 'receb.py', 'recex.py', 'rg1361.py', 'wsaa.py', 'wsfex.py', 'wsbfe.py']
# visual application
if 'pyrece' in globals():
# find pythoncard resources, to add as 'data_files'
pycard_resources=[]
for filename in os.listdir('.'):
if filename.find('.rsrc.')>-1:
pycard_resources+=[filename]
kwargs['console'] += [
Target(module=pyrece, script="pyrece.py", dest_base="pyrece_consola"),
]
kwargs['windows'] += [
Target(module=pyrece, script='pyrece.py'),
]
data_files += [
(".", [
"C:\python25\lib\site-packages\wx-2.8-msw-unicode\wx\MSVCP71.dll",
"C:\python25\lib\site-packages\wx-2.8-msw-unicode\wx\MSVCR71.dll",
"C:\python25\lib\site-packages\wx-2.8-msw-unicode\wx\gdiplus.dll",
]),
("plantillas", ["plantillas/logo.png", ]),
("datos", ["datos/facturas.csv", "datos/facturas.json", "datos/facturas.txt", ])
]
data_files.append((".", pycard_resources))
# new webservices:
if 'wsaa' in globals():
kwargs['com_server'] += [Target(module=wsaa, modules='wsaa', create_exe=not wsaa.TYPELIB, create_dll=not wsaa.TYPELIB)]
kwargs['console'] += [Target(module=wsaa, script="wsaa.py", dest_base="wsaa-cli")]
if wsaa.TYPELIB:
kwargs['windows'] += [Target(module=wsaa, script="wsaa.py", dest_base="wsaa")]
data_files.append((".", ["wsaa.tlb"]))
__version__ += "+wsaa_" + wsaa.__version__
HOMO &= wsaa.HOMO
if 'wsfev1' in globals():
kwargs['com_server'] += [
Target(module=wsfev1, modules="wsfev1", create_exe=not wsfev1.TYPELIB, create_dll=not wsfev1.TYPELIB)
]
kwargs['console'] += [
Target(module=wsfev1, script='wsfev1.py', dest_base="wsfev1_cli"),
Target(module=rece1, script='rece1.py'),
]
if wsfev1.TYPELIB:
kwargs['windows'] += [Target(module=wsaa, script="wsfev1.py", dest_base="wsfev1")]
data_files.append((".", ["wsfev1.tlb"]))
__version__ += "+wsfev1_" + wsfev1.__version__
HOMO &= wsfev1.HOMO
if 'wsfexv1' in globals():
kwargs['com_server'] += [
Target(module=wsfexv1, modules="wsfexv1", create_exe=True, create_dll=True)
]
kwargs['console'] += [
Target(module=wsfexv1, script='wsfexv1.py', dest_base="wsfexv1_cli"),
Target(module=recex1, script='recex1.py'),
]
__version__ += "+wsfexv1_" + wsfexv1.__version__
HOMO &= wsfexv1.HOMO
if 'wsbfev1' in globals():
kwargs['com_server'] += [
Target(module=wsbfev1, modules="wsbfev1", create_exe=True, create_dll=True)
]
kwargs['console'] += [
Target(module=wsbfev1, script='wsbfev1.py', dest_base="wsbfev1_cli"),
Target(module=receb1, script='receb1.py'),
]
__version__ += "+wsbfev_" + wsbfev1.__version__
HOMO &= wsbfev1.HOMO
if 'wsmtx' in globals():
kwargs['com_server'] += [
Target(module=wsmtx, modules="wsmtx", create_exe=True, create_dll=True)
]
kwargs['console'] += [
Target(module=wsmtx, script='wsmtx.py', dest_base="wsmtx_cli"),
Target(module=recem, script='recem.py'),
]
__version__ += "+wsmtx_" + wsmtx.__version__
HOMO &= wsmtx.HOMO
if 'pyfepdf' in globals():
kwargs['com_server'] += [
Target(module=pyfepdf, modules="pyfepdf", create_exe=False, create_dll=True),
]
kwargs['console'] += [
Target(module=pyfepdf, script='pyfepdf.py', dest_base="pyfepdf"),
]
kwargs['windows'] += [
Target(module=pyfepdf, script="pyfepdf.py", dest_base="pyfepdf_com"),
]
data_files += [
]
__version__ += "+pyfepdf_" + pyfepdf.__version__
HOMO &= pyfepdf.HOMO
if 'pyemail' in globals():
kwargs['com_server'] += [
Target(module=pyemail, modules="pyemail", create_exe=False, create_dll=True),
]
kwargs['console'] += [
Target(module=pyemail, script='pyemail.py', dest_base="pyemail"),
]
kwargs['windows'] += [
Target(module=pyemail, script="pyemail.py", dest_base="pyemail_com"),
]
data_files += [
]
__version__ += "+pyemail_" + pyemail.__version__
if 'pyi25' in globals():
kwargs['com_server'] += [
Target(module=pyi25, modules="pyi25", create_exe=False, create_dll=True),
]
kwargs['console'] += [
Target(module=pyi25, script='pyi25.py', dest_base="pyi25"),
]
kwargs['windows'] += [
Target(module=pyi25, script="pyi25.py", dest_base="pyi25_com"),
]
data_files += [
]
__version__ += "+pyi25_" + pyi25.__version__
if 'designer' in globals():
kwargs['windows'] += [
Target(module=designer, script="designer.py", dest_base="designer"),
]
if 'wsctgv2' in globals():
kwargs['com_server'] += [
Target(module=wsctgv2, modules="wsctgv2"),
]
kwargs['console'] += [
Target(module=wsctgv2, script='wsctgv2.py', dest_base="wsctgv2_cli"),
]
__version__ += "+wsctgv2_" + wsctgv2.__version__
HOMO &= wsctgv2.HOMO
if 'wslpg' in globals():
kwargs['com_server'] += [
Target(module=wslpg, modules="wslpg"),
]
kwargs['console'] += [
Target(module=wslpg, script='wslpg.py', dest_base="wslpg_cli"),
]
data_files += [
("conf", ["conf/wslpg.ini"]),
("plantillas", [
"plantillas/liquidacion_form_c1116b_wslpg.csv",
"plantillas/liquidacion_form_c1116b_wslpg.png",
"plantillas/liquidacion_wslpg_ajuste_base.csv",
"plantillas/liquidacion_wslpg_ajuste_base.png",
"plantillas/liquidacion_wslpg_ajuste_debcred.csv",
"plantillas/liquidacion_wslpg_ajuste_debcred.png",
]),
]
__version__ += "+wslpg_" + wslpg.__version__
HOMO &= wslpg.HOMO
if 'wscoc' in globals():
kwargs['com_server'] += [
Target(module=wscoc,modules="wscoc"),
]
kwargs['console'] += [
Target(module=wscoc, script='wscoc.py', dest_base="wscoc_cli"),
]
__version__ += "+wscoc_" + wscoc.__version__
HOMO &= wscoc.HOMO
if 'wscdc' in globals():
kwargs['com_server'] += [
Target(module=wscdc,modules="wscdc", create_exe=True, create_dll=True),
]
kwargs['console'] += [
Target(module=wscdc, script='wscdc.py', dest_base="wscdc_cli"),
]
__version__ += "+wscdc_" + wscdc.__version__
HOMO &= wscdc.HOMO
if 'cot' in globals():
kwargs['com_server'] += [
Target(module=cot,modules="cot")
]
kwargs['console'] += [
Target(module=cot, script='cot.py', dest_base="cot_cli")
]
kwargs['windows'] += [
Target(module=cot, script='cot.pyw', dest_base="cot_win"),
]
data_files += [("datos", [
"datos/TB_20111111112_000000_20080124_000001.txt",
"datos/TB_20111111112_000000_20080124_000001.xml",
"datos/TB_20111111112_000000_20101229_000001.txt",
"datos/TB_20111111112_000000_20101229_000001.xml",
])]
__version__ += "+cot_" + cot.__version__
HOMO &= cot.HOMO
if 'trazamed' in globals():
kwargs['com_server'] += [
Target(module=trazamed, modules="trazamed", create_exe=not trazamed.TYPELIB, create_dll=not trazamed.TYPELIB),
]
kwargs['console'] += [
Target(module=trazamed, script='trazamed.py', dest_base="trazamed_cli"),
]
if trazamed.TYPELIB:
kwargs['windows'] += [Target(module=trazamed, script="trazamed.py", dest_base="trazamed")]
data_files.append((".", ["trazamed.tlb"]))
__version__ += "+trazamed_" + trazamed.__version__
HOMO &= trazamed.HOMO
if 'trazarenpre' in globals():
kwargs['com_server'] += [
Target(module=trazarenpre, modules="trazarenpre", create_exe=not trazarenpre.TYPELIB, create_dll=not trazarenpre.TYPELIB),
]
kwargs['console'] += [
Target(module=trazarenpre, script='trazarenpre.py', dest_base="trazarenpre_cli"),
]
if trazarenpre.TYPELIB:
kwargs['windows'] += [Target(module=trazarenpre, script="trazarenpre.py", dest_base="trazarenpre")]
data_files.append((".", ["trazarenpre.tlb"]))
__version__ += "+trazarenpre_" + trazarenpre.__version__
HOMO &= trazarenpre.HOMO
if 'trazafito' in globals():
kwargs['com_server'] += [
Target(module=trazafito, modules="trazafito", create_exe=True, create_dll=False),
]
kwargs['console'] += [
Target(module=trazafito, script='trazafito.py', dest_base="trazafito_cli"),
]
__version__ += "+trazafito_" + trazafito.__version__
HOMO &= trazafito.HOMO
if 'padron' in globals():
kwargs['com_server'] += [
Target(module=padron, modules="padron", create_exe=True, create_dll=True),
]
kwargs['console'] += [
Target(module=padron, script='padron.py', dest_base="padron_cli"),
]
if os.path.exists("padron.db"):
data_files += [(".", [
"padron.db",
])]
__version__ += "+padron_" + padron.__version__
#HOMO &= padron.HOMO
# custom installer:
kwargs['cmdclass'] = {"py2exe": build_installer}
if sys.version_info > (2, 7):
# add MSVCP90.dll path for py2exe
sys.path.append("C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\redist\\x86\\Microsoft.VC90.CRT")
data_files += [
("Microsoft.VC90.CRT", glob.glob(r'C:\Python27\Lib\site-packages\pythonwin\mfc*.*')),
("Microsoft.VC90.CRT", glob.glob(r'C:\Python27\Lib\site-packages\pythonwin\Microsoft.VC90.MFC.manifest')),
]
# agrego tag de homologación (testing - modo evaluación):
__version__ += "-homo" if HOMO else "-full"
else:
desc = "Paquete PyAfipWs"
kwargs['package_dir'] = {'pyafipws': '.'}
kwargs['packages'] = ['pyafipws']
opts = {}
setup(name="PyAfipWs",
version=__version__,
description=desc,
long_description=long_desc,
author="Mariano Reingart",
author_email="[email protected]",
url="https://code.google.com/p/pyafipws/" if 'register' in sys.argv
else "http://www.sistemasagiles.com.ar",
license="GNU GPL v3",
options=opts,
data_files=data_files,
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Financial and Insurance Industry",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python",
"Programming Language :: Python :: 2.5",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
#"Programming Language :: Python :: 3.2",
"Operating System :: OS Independent",
"Operating System :: Microsoft :: Windows",
"Natural Language :: Spanish",
"Topic :: Office/Business :: Financial :: Point-Of-Sale",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Object Brokering",
],
keywords="webservice electronic invoice pdf traceability",
**kwargs
)