2024-08-29 10:29:12 -04:00
|
|
|
import os
|
|
|
|
import shutil
|
2024-12-27 13:11:42 -05:00
|
|
|
from pathlib import Path
|
|
|
|
import tomli_w
|
|
|
|
import tomllib
|
2024-08-29 10:29:12 -04:00
|
|
|
|
|
|
|
source_dir = os.getcwd()
|
|
|
|
target_dir = "{{ cookiecutter.__final_destination }}"
|
|
|
|
|
|
|
|
shutil.move(source_dir, target_dir)
|
2024-12-27 13:11:42 -05:00
|
|
|
|
|
|
|
THIS_FILE_DIR = Path(__file__).parent
|
|
|
|
|
|
|
|
# Add the package to the workspace def
|
|
|
|
|
|
|
|
workspace_def_path = THIS_FILE_DIR / ".." / ".." / ".." / "pyproject.toml"
|
|
|
|
|
|
|
|
with workspace_def_path.open("rb") as f:
|
|
|
|
config = tomllib.load(f)
|
|
|
|
|
|
|
|
config["tool"]["uv"]["sources"]["{{ cookiecutter.package_name }}"] = {"workspace": True}
|
|
|
|
|
|
|
|
with workspace_def_path.open("wb") as f:
|
|
|
|
tomli_w.dump(config, f)
|