@@ -5,6 +5,7 @@ PyInstaller spec for OpenHands Agent Server with PEP 420 (implicit namespace) la
55
66from pathlib import Path
77import os
8+ import site
89from PyInstaller .utils .hooks import (
910 collect_submodules ,
1011 collect_data_files ,
@@ -24,6 +25,37 @@ PATHEX = [
2425# Entry script for the agent server package (namespace: openhands/agent_server/__main__.py)
2526ENTRY = str (project_root / "openhands-agent-server" / "openhands" / "agent_server" / "__main__.py" )
2627
28+ # Find fakeredis package location to get commands.json with correct path
29+ def get_fakeredis_data ():
30+ """Get fakeredis data files with correct directory structure.
31+
32+ fakeredis/model/_command_info.py uses Path(__file__).parent.parent / "commands.json"
33+ which means it expects commands.json to be at fakeredis/commands.json when accessed
34+ from fakeredis/model/. We need to ensure the model/ subdirectory exists in the bundle.
35+ """
36+ import fakeredis
37+ fakeredis_dir = Path (fakeredis .__file__ ).parent
38+ commands_json = fakeredis_dir / "commands.json"
39+
40+ data_files = []
41+ if commands_json .exists ():
42+ # Add commands.json to fakeredis/ directory
43+ data_files .append ((str (commands_json ), "fakeredis" ))
44+
45+ # Add a placeholder file to create the model/ subdirectory structure
46+ # This ensures Path(__file__).parent.parent works correctly for model/ modules
47+ model_dir = fakeredis_dir / "model"
48+ if model_dir .exists ():
49+ # Find any .py file in model/ to include (PyInstaller needs at least one file)
50+ for py_file in model_dir .glob ("*.py" ):
51+ # We don't actually need the .py files (they're compiled), but we need
52+ # the __init__.py to create the directory structure
53+ if py_file .name == "__init__.py" :
54+ data_files .append ((str (py_file ), "fakeredis/model" ))
55+ break
56+
57+ return data_files
58+
2759a = Analysis (
2860 [ENTRY ],
2961 pathex = PATHEX ,
@@ -35,6 +67,8 @@ a = Analysis(
3567 * collect_data_files ("litellm" ),
3668 * collect_data_files ("fastmcp" ),
3769 * collect_data_files ("mcp" ),
70+ * collect_data_files ("fakeredis" ), # Required for commands.json used by fakeredis ACL
71+ * get_fakeredis_data (), # Ensure fakeredis/model/ directory structure exists
3872
3973 # OpenHands SDK prompt templates (adjusted for shallow namespace layout)
4074 * collect_data_files ("openhands.sdk.agent" , includes = ["prompts/*.j2" ]),
@@ -63,6 +97,8 @@ a = Analysis(
6397 * collect_submodules ("tiktoken_ext" ),
6498 * collect_submodules ("litellm" ),
6599 * collect_submodules ("fastmcp" ),
100+ * collect_submodules ("fakeredis" ),
101+ * collect_submodules ("lupa" ), # Required for fakeredis[lua] Lua scripting support
66102
67103 # mcp subpackages used at runtime (avoid CLI)
68104 "mcp.types" ,
0 commit comments