mirror of
https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
synced 2026-11-30 06:42:54 +08:00
Improve rules.json handling in setup.py
- Always copy rules.json from project root to package root and src directory - Add robust handling for project-level rules.json file - Enhance logging for rules.json copying process - Add warning if rules.json is not found in project root
This commit is contained in:
@@ -24,12 +24,22 @@ if readme_path.exists():
|
|||||||
with open(readme_path, "r", encoding="utf-8") as f:
|
with open(readme_path, "r", encoding="utf-8") as f:
|
||||||
long_description = f.read()
|
long_description = f.read()
|
||||||
|
|
||||||
# Copy rules.json to src directory if it doesn't exist
|
# Always copy the latest rules.json from project root to ensure consistency
|
||||||
rules_json_src = Path("rules.json")
|
project_root = Path(__file__).parent.parent
|
||||||
rules_json_dest = Path("src/rules.json")
|
root_rules_json = project_root / "rules.json"
|
||||||
if rules_json_src.exists() and not rules_json_dest.exists():
|
package_rules_json = Path("rules.json")
|
||||||
shutil.copy2(rules_json_src, rules_json_dest)
|
src_rules_json = Path("src/rules.json")
|
||||||
print(f"Copied rules.json to {rules_json_dest}")
|
|
||||||
|
if root_rules_json.exists():
|
||||||
|
# Copy to package root
|
||||||
|
shutil.copy2(root_rules_json, package_rules_json)
|
||||||
|
print(f"Copied rules.json from project root to package root")
|
||||||
|
|
||||||
|
# Copy to src directory
|
||||||
|
shutil.copy2(root_rules_json, src_rules_json)
|
||||||
|
print(f"Copied rules.json from project root to {src_rules_json}")
|
||||||
|
else:
|
||||||
|
print("Warning: rules.json not found in project root")
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="cursor-rules",
|
name="cursor-rules",
|
||||||
|
|||||||
Reference in New Issue
Block a user