-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
57 lines (44 loc) · 1.36 KB
/
setup.py
File metadata and controls
57 lines (44 loc) · 1.36 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
"""
Setup with post-install hook for OpenClaw auto-integration.
When a user runs `pip install cortex-mem`, this will:
1. Install the package
2. Check for OpenClaw
3. Auto-configure if found
4. Offer workspace migration
"""
import atexit
import subprocess
import sys
from pathlib import Path
from setuptools import setup
from setuptools.command.develop import develop
from setuptools.command.install import install
def post_install():
"""Post-install hook for OpenClaw integration."""
try:
# Import the plugin and run auto-install
from cortex_mem.openclaw_plugin import auto_install
auto_install()
except ImportError:
# Package not yet installed, skip
pass
except Exception as e:
# Don't fail the install on auto-config errors
print(f"Note: Auto-configuration skipped ({e})")
class PostInstallCommand(install):
"""Post-install command that runs OpenClaw auto-config."""
def run(self):
install.run(self)
# Run post-install after the package is installed
atexit.register(post_install)
class PostDevelopCommand(develop):
"""Post-develop command that runs OpenClaw auto-config."""
def run(self):
develop.run(self)
atexit.register(post_install)
setup(
cmdclass={
'install': PostInstallCommand,
'develop': PostDevelopCommand,
},
)