|
6 | 6 | from pathlib import Path
|
7 | 7 |
|
8 | 8 | from setuptools import find_packages, setup
|
9 |
| -from setuptools.command.build_py import build_py |
10 |
| - |
11 |
| - |
12 |
| -class BuildPyCommand(build_py): |
13 |
| - """Custom build command to copy prompt files.""" |
14 |
| - |
15 |
| - def run(self): |
16 |
| - # Copy prompt files from project root to package |
17 |
| - root_dir = Path(__file__).parent.parent |
18 |
| - package_dir = Path(__file__).parent / "heart_centered_prompts" |
19 |
| - prompts_dir = root_dir / "prompts" |
20 |
| - package_prompts_dir = package_dir / "prompts" |
21 |
| - |
22 |
| - # Ensure the base prompts directory exists |
23 |
| - package_prompts_dir.mkdir(parents=True, exist_ok=True) |
24 |
| - |
25 |
| - if prompts_dir.exists(): |
26 |
| - for collection in prompts_dir.iterdir(): |
27 |
| - if collection.is_dir(): |
28 |
| - # Create collection directory if it doesn't exist |
29 |
| - collection_path = package_prompts_dir / collection.name |
30 |
| - collection_path.mkdir(parents=True, exist_ok=True) |
31 |
| - |
32 |
| - # Copy prompt files |
33 |
| - for prompt_file in collection.glob("*.txt"): |
34 |
| - dest_file = collection_path / prompt_file.name |
35 |
| - shutil.copy2(prompt_file, dest_file) |
36 |
| - |
37 |
| - # Run the regular build_py command |
38 |
| - super().run() |
39 |
| - |
40 | 9 |
|
41 | 10 | # Read the contents of README.md
|
42 | 11 | readme_path = Path(__file__).parent / "README.md"
|
43 | 12 | with readme_path.open("r", encoding="utf-8") as f:
|
44 | 13 | long_description = f.read()
|
45 | 14 |
|
| 15 | +# Copy prompt files from project root to package |
| 16 | +root_dir = Path(__file__).parent.parent |
| 17 | +package_dir = Path(__file__).parent / "heart_centered_prompts" |
| 18 | +prompts_dir = root_dir / "prompts" |
| 19 | +package_prompts_dir = package_dir / "prompts" |
| 20 | + |
| 21 | +# Ensure the base prompts directory exists |
| 22 | +package_prompts_dir.mkdir(parents=True, exist_ok=True) |
| 23 | + |
| 24 | +if prompts_dir.exists(): |
| 25 | + for collection in prompts_dir.iterdir(): |
| 26 | + if collection.is_dir(): |
| 27 | + # Create collection directory if it doesn't exist |
| 28 | + collection_path = package_prompts_dir / collection.name |
| 29 | + collection_path.mkdir(parents=True, exist_ok=True) |
| 30 | + |
| 31 | + # Copy prompt files |
| 32 | + for prompt_file in collection.glob("*.txt"): |
| 33 | + dest_file = collection_path / prompt_file.name |
| 34 | + shutil.copy2(prompt_file, dest_file) |
46 | 35 |
|
47 | 36 | setup(
|
48 | 37 | name="heart_centered_prompts",
|
@@ -75,8 +64,5 @@ def run(self):
|
75 | 64 | package_data={
|
76 | 65 | "heart_centered_prompts": ["prompts/*/*.txt"],
|
77 | 66 | },
|
78 |
| - cmdclass={ |
79 |
| - "build_py": BuildPyCommand, |
80 |
| - }, |
81 | 67 | zip_safe=False,
|
82 | 68 | )
|
0 commit comments