-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprat.spec
More file actions
105 lines (93 loc) · 2.42 KB
/
prat.spec
File metadata and controls
105 lines (93 loc) · 2.42 KB
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
# -*- mode: python ; coding: utf-8 -*-
"""
PyInstaller spec file para PRAT
Genera un ejecutable único para Windows y Linux
"""
import os
import sys
import platform
block_cipher = None
# Detectar plataforma
IS_WINDOWS = platform.system() == 'Windows'
IS_LINUX = platform.system() == 'Linux'
IS_MAC = platform.system() == 'Darwin'
# Directorio base
BASE_DIR = os.path.dirname(os.path.abspath(SPEC))
# Archivos de datos a incluir
datas = [
(os.path.join(BASE_DIR, 'media', 'prat_logo.png'), 'media'),
(os.path.join(BASE_DIR, 'media', 'prat_logo_blanco.jpg'), 'media'),
]
# Filtrar archivos que existen
datas = [(src, dst) for src, dst in datas if os.path.exists(src)]
# Hidden imports comunes
hiddenimports = [
'PyQt6.QtCore',
'PyQt6.QtGui',
'PyQt6.QtWidgets',
'sqlalchemy.sql.default_comparator',
'reportlab.graphics.barcode.common',
'reportlab.graphics.barcode.code39',
'reportlab.graphics.barcode.code93',
'reportlab.graphics.barcode.code128',
'reportlab.graphics.barcode.usps',
'reportlab.graphics.barcode.usps4s',
]
# Imports adicionales para Linux
if IS_LINUX:
hiddenimports.extend([
'PyQt6.QtDBus',
])
a = Analysis(
['run.py'],
pathex=[BASE_DIR],
binaries=[],
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[
'tkinter',
'matplotlib',
'numpy',
'pandas',
'scipy',
'django',
],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
# Configuración del icono según plataforma
icon_path = os.path.join(BASE_DIR, 'media', 'prat_logo.png')
if IS_WINDOWS:
# Windows prefiere .ico, pero .png también funciona
icon_file = icon_path if os.path.exists(icon_path) else None
else:
# Linux usa .png
icon_file = icon_path if os.path.exists(icon_path) else None
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='PRAT',
debug=False,
bootloader_ignore_signals=False,
strip=IS_LINUX, # Strip en Linux para reducir tamaño
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False, # Sin consola (GUI)
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=icon_file,
)