175 lines
4.3 KiB
RPMSpec
175 lines
4.3 KiB
RPMSpec
# -*- mode: python ; coding: utf-8 -*-
|
|
import os
|
|
import sys
|
|
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
|
|
|
|
block_cipher = None
|
|
|
|
# Windows-specific paths
|
|
base_path = os.path.abspath('.')
|
|
python_path = sys.executable
|
|
|
|
# Collect modules
|
|
try:
|
|
odoo_submodules = collect_submodules('odoo')
|
|
addon_submodules = collect_submodules('odoo.addons')
|
|
crypto_modules = collect_submodules('cryptography')
|
|
reportlab_modules = collect_submodules('reportlab')
|
|
babel_modules = collect_submodules('babel')
|
|
psycopg2_modules = collect_submodules('psycopg2')
|
|
except Exception:
|
|
odoo_submodules = []
|
|
addon_submodules = []
|
|
crypto_modules = []
|
|
reportlab_modules = []
|
|
babel_modules = []
|
|
psycopg2_modules = []
|
|
|
|
# Collect data files
|
|
try:
|
|
babel_data = collect_data_files('babel')
|
|
reportlab_data = collect_data_files('reportlab')
|
|
psycopg2_data = collect_data_files('psycopg2')
|
|
except Exception:
|
|
babel_data = []
|
|
reportlab_data = []
|
|
psycopg2_data = []
|
|
|
|
a = Analysis(
|
|
['odoo-bin'],
|
|
pathex=[base_path],
|
|
binaries=[
|
|
# Windows-specific binaries
|
|
# PostgreSQL client libraries (if needed)
|
|
# ('C:\\Program Files\\PostgreSQL\\15\\bin\\libpq.dll', '.'),
|
|
# ('C:\\Program Files\\PostgreSQL\\15\\bin\\libeay32.dll', '.'),
|
|
# ('C:\\Program Files\\PostgreSQL\\15\\bin\\ssleay32.dll', '.'),
|
|
],
|
|
datas=[
|
|
# Core Odoo files
|
|
('addons', 'addons'),
|
|
('odoo', 'odoo'),
|
|
('extra-addons', 'extra-addons'),
|
|
|
|
# Configuration files
|
|
('odoo.conf', '.'),
|
|
('*.conf', '.'),
|
|
|
|
# Windows-specific: Include wkhtmltopdf if available
|
|
# ('C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe', 'wkhtmltopdf'),
|
|
# ('C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltoimage.exe', 'wkhtmltopdf'),
|
|
|
|
] + babel_data + reportlab_data + psycopg2_data,
|
|
|
|
hiddenimports=[
|
|
# Core Python modules
|
|
'pkg_resources.py2_warn',
|
|
'pkg_resources',
|
|
|
|
# Database drivers
|
|
'psycopg2',
|
|
'psycopg2.extensions',
|
|
'psycopg2.extras',
|
|
'psycopg2._psycopg',
|
|
|
|
# Windows-specific modules
|
|
'win32api',
|
|
'win32con',
|
|
'win32event',
|
|
'win32file',
|
|
'win32pipe',
|
|
'win32process',
|
|
'win32security',
|
|
'pywintypes',
|
|
'pythoncom',
|
|
|
|
# Core Odoo dependencies
|
|
'lxml',
|
|
'lxml.etree',
|
|
'lxml.html',
|
|
'werkzeug',
|
|
'babel',
|
|
'passlib',
|
|
'dateutil',
|
|
'pytz',
|
|
'PIL',
|
|
'reportlab',
|
|
'openpyxl',
|
|
'xlrd',
|
|
'xlwt',
|
|
'requests',
|
|
'urllib3',
|
|
'jinja2',
|
|
'markupsafe',
|
|
|
|
# Odoo core modules
|
|
'odoo',
|
|
'odoo.addons',
|
|
'odoo.tools',
|
|
'odoo.tools.pdf',
|
|
'odoo.tools.pdf._pypdf',
|
|
'odoo.tools.pdf._pypdf2_1',
|
|
'odoo.tools.pdf._pypdf2_2',
|
|
'odoo.service',
|
|
'odoo.http',
|
|
'odoo.cli',
|
|
|
|
# Additional Windows-specific
|
|
'email.mime.multipart',
|
|
'email.mime.text',
|
|
'email.mime.base',
|
|
'timeit',
|
|
|
|
] + odoo_submodules + addon_submodules + crypto_modules + reportlab_modules + babel_modules + psycopg2_modules,
|
|
|
|
hookspath=[],
|
|
runtime_hooks=[],
|
|
excludes=[
|
|
# Exclude unnecessary modules
|
|
'tkinter',
|
|
'matplotlib',
|
|
'scipy',
|
|
'pandas',
|
|
'jupyter',
|
|
'notebook',
|
|
'ipython',
|
|
'django',
|
|
'flask',
|
|
'tornado',
|
|
'twisted',
|
|
],
|
|
win_no_prefer_redirects=False,
|
|
win_private_assemblies=False,
|
|
cipher=block_cipher,
|
|
noarchive=False,
|
|
)
|
|
|
|
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
|
|
|
exe = EXE(
|
|
pyz,
|
|
a.scripts,
|
|
[],
|
|
exclude_binaries=True,
|
|
name='odoo18',
|
|
debug=False,
|
|
bootloader_ignore_signals=False,
|
|
strip=False,
|
|
upx=True,
|
|
console=True, # Keep console for debugging
|
|
disable_windowed_traceback=False,
|
|
target_arch=None,
|
|
codesign_identity=None,
|
|
entitlements_file=None,
|
|
icon='odoo_icon.ico', # Add Odoo icon if available
|
|
)
|
|
|
|
coll = COLLECT(
|
|
exe,
|
|
a.binaries,
|
|
a.datas,
|
|
strip=False,
|
|
upx=True,
|
|
upx_exclude=[],
|
|
name='odoo18',
|
|
) |