Fix launcher path logic for proper system/local separation
- Add runtime detection of installation type based on launcher location - Local installations (~/.local/bin) now correctly load from ~/.local/lib/python*/site-packages - System installations (/usr/bin) load from /usr/lib/python*/site-packages - Source directory execution continues to work from development tree - Restores clear separation between system and local installations like autotools had 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -42,19 +42,25 @@ def setup_paths():
|
||||
# Running from source directory
|
||||
sys.path.insert(0, os.path.dirname(currentDir))
|
||||
pythondir = currentDir
|
||||
datadir = currentDir
|
||||
else:
|
||||
# Running installed
|
||||
sys.prefix = '/usr'
|
||||
pythondir = os.path.join(sys.prefix, 'lib', f'python{sys.version_info.major}.{sys.version_info.minor}', 'site-packages')
|
||||
# Running installed - determine if local or system based on actual path
|
||||
if currentDir.startswith(os.path.expanduser('~/.local')):
|
||||
# Local installation (~/.local/bin/cthulhu)
|
||||
prefix = os.path.expanduser('~/.local')
|
||||
pythondir = os.path.join(prefix, 'lib', f'python{sys.version_info.major}.{sys.version_info.minor}', 'site-packages')
|
||||
datadir = os.path.join(prefix, 'share', 'cthulhu')
|
||||
else:
|
||||
# System installation (/usr/bin/cthulhu)
|
||||
prefix = '/usr'
|
||||
pythondir = os.path.join(prefix, 'lib', f'python{sys.version_info.major}.{sys.version_info.minor}', 'site-packages')
|
||||
datadir = os.path.join(prefix, 'share', 'cthulhu')
|
||||
|
||||
sys.path.insert(1, pythondir)
|
||||
|
||||
# Set environment variables for resource paths
|
||||
if 'CTHULHU_DATA_DIR' not in os.environ:
|
||||
if os.path.exists(os.path.join(currentDir, 'plugins')):
|
||||
os.environ['CTHULHU_DATA_DIR'] = currentDir
|
||||
else:
|
||||
os.environ['CTHULHU_DATA_DIR'] = os.path.join(sys.prefix, 'share', 'cthulhu')
|
||||
os.environ['CTHULHU_DATA_DIR'] = datadir
|
||||
|
||||
# Set up paths before importing Cthulhu modules
|
||||
setup_paths()
|
||||
|
Reference in New Issue
Block a user