| 1 |
# -*- mode: python ; coding: utf-8 -*- |
| 2 |
""" |
| 3 |
PyInstaller spec file for dirsearch |
| 4 |
Generates standalone executables for multiple platforms |
| 5 |
""" |
| 6 |
|
| 7 |
import os |
| 8 |
import sys |
| 9 |
from PyInstaller.utils.hooks import collect_data_files, collect_submodules |
| 10 |
|
| 11 |
block_cipher = None |
| 12 |
|
| 13 |
# Get the project root directory |
| 14 |
SPEC_DIR = os.path.dirname(os.path.abspath(SPEC)) |
| 15 |
PROJECT_ROOT = os.path.dirname(SPEC_DIR) |
| 16 |
|
| 17 |
# Collect all submodules from lib |
| 18 |
hidden_imports = collect_submodules('lib') |
| 19 |
|
| 20 |
# Add required dependencies that might not be auto-detected |
| 21 |
hidden_imports += [ |
| 22 |
'requests', |
| 23 |
'httpx', |
| 24 |
'httpx._transports', |
| 25 |
'httpx._transports.default', |
| 26 |
'urllib3', |
| 27 |
'charset_normalizer', |
| 28 |
'certifi', |
| 29 |
'idna', |
| 30 |
'PySocks', |
| 31 |
'socks', |
| 32 |
'jinja2', |
| 33 |
'markupsafe', |
| 34 |
'defusedxml', |
| 35 |
'OpenSSL', |
| 36 |
'cryptography', |
| 37 |
'ntlm_auth', |
| 38 |
'requests_ntlm', |
| 39 |
'bs4', |
| 40 |
'beautifulsoup4', |
| 41 |
'colorama', |
| 42 |
'mysql.connector', |
| 43 |
'psycopg', |
| 44 |
'defusedcsv', |
| 45 |
'requests_toolbelt', |
| 46 |
'httpx_ntlm', |
| 47 |
'h11', |
| 48 |
'h2', |
| 49 |
'hpack', |
| 50 |
'hyperframe', |
| 51 |
'anyio', |
| 52 |
'sniffio', |
| 53 |
'httpcore', |
| 54 |
'socksio', |
| 55 |
] |
| 56 |
|
| 57 |
# Data files to include |
| 58 |
datas = [ |
| 59 |
(os.path.join(PROJECT_ROOT, 'db'), 'db'), |
| 60 |
(os.path.join(PROJECT_ROOT, 'config.ini'), '.'), |
| 61 |
] |
| 62 |
|
| 63 |
# Add static directory if it exists |
| 64 |
static_dir = os.path.join(PROJECT_ROOT, 'static') |
| 65 |
if os.path.exists(static_dir): |
| 66 |
datas.append((static_dir, 'static')) |
| 67 |
|
| 68 |
# Jinja2 templates from lib/report |
| 69 |
report_templates = os.path.join(PROJECT_ROOT, 'lib', 'report') |
| 70 |
if os.path.exists(report_templates): |
| 71 |
datas.append((report_templates, 'lib/report')) |
| 72 |
|
| 73 |
a = Analysis( |
| 74 |
[os.path.join(PROJECT_ROOT, 'dirsearch.py')], |
| 75 |
pathex=[PROJECT_ROOT], |
| 76 |
binaries=[], |
| 77 |
datas=datas, |
| 78 |
hiddenimports=hidden_imports, |
| 79 |
hookspath=[], |
| 80 |
hooksconfig={}, |
| 81 |
runtime_hooks=[], |
| 82 |
excludes=[ |
| 83 |
'tkinter', |
| 84 |
'unittest', |
| 85 |
'pydoc', |
| 86 |
'doctest', |
| 87 |
'test', |
| 88 |
'tests', |
| 89 |
], |
| 90 |
win_no_prefer_redirects=False, |
| 91 |
win_private_assemblies=False, |
| 92 |
cipher=block_cipher, |
| 93 |
noarchive=False, |
| 94 |
) |
| 95 |
|
| 96 |
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) |
| 97 |
|
| 98 |
exe = EXE( |
| 99 |
pyz, |
| 100 |
a.scripts, |
| 101 |
a.binaries, |
| 102 |
a.zipfiles, |
| 103 |
a.datas, |
| 104 |
[], |
| 105 |
name='dirsearch', |
| 106 |
debug=False, |
| 107 |
bootloader_ignore_signals=False, |
| 108 |
strip=False, |
| 109 |
upx=True, |
| 110 |
upx_exclude=[], |
| 111 |
runtime_tmpdir=None, |
| 112 |
console=True, |
| 113 |
disable_windowed_traceback=False, |
| 114 |
argv_emulation=False, |
| 115 |
target_arch=None, |
| 116 |
codesign_identity=None, |
| 117 |
entitlements_file=None, |
| 118 |
icon=None, |
| 119 |
) |