-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathsetup.py
More file actions
37 lines (31 loc) · 1.44 KB
/
setup.py
File metadata and controls
37 lines (31 loc) · 1.44 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
from setuptools import setup
from setuptools.command.install import install
import os
import shutil
class CustomInstallCommand(install):
def run(self):
# Run the standard install
super().run()
# Write 'providers.d' to '~/.llama/providers.d'
# This allows users to see the remote providers
providers_dir = os.path.join(self.install_lib, "ramalama_stack", "providers.d")
target_dir_1 = os.path.expanduser("~/.llama/providers.d")
try:
os.makedirs(target_dir_1, exist_ok=True)
shutil.copytree(providers_dir, target_dir_1, dirs_exist_ok=True)
print(f"Copied {providers_dir} to {target_dir_1}")
except Exception as error:
print(f"Failed to copy {providers_dir} to {target_dir_1}. Error: {error}")
raise
# Write `ramalama-run.yaml` to '~/.llama/distributions/ramalama'
# This allows users to run the stack
run_yaml = os.path.join(self.install_lib, "ramalama_stack", "ramalama-run.yaml")
target_dir_2 = os.path.expanduser("~/.llama/distributions/ramalama")
try:
os.makedirs(target_dir_2, exist_ok=True)
shutil.copy(run_yaml, target_dir_2)
print(f"Copied {run_yaml} to {target_dir_2}")
except Exception as error:
print(f"Failed to copy {providers_dir} to {target_dir_1}. Error: {error}")
raise
setup(cmdclass={"install": CustomInstallCommand})