|
4 | 4 |
|
5 | 5 | import tomlkit |
6 | 6 |
|
7 | | -# Merge pyproject.toml.update into pyproject.toml |
8 | | -with open("pyproject.toml", "r") as fp: |
9 | | - pyproject_toml = tomlkit.load(fp) |
| 7 | +for base_path in [ |
| 8 | + ".", |
| 9 | + "pulp-glue{{ cookiecutter.__app_label_suffix }}", |
| 10 | +]: |
| 11 | + # Merge pyproject.toml.update into pyproject.toml |
| 12 | + with open(os.path.join(base_path, "pyproject.toml"), "r") as fp: |
| 13 | + pyproject_toml = tomlkit.load(fp) |
10 | 14 |
|
11 | | -with open("pyproject.toml.update", "r") as fp: |
12 | | - pyproject_toml_update = tomlkit.load(fp) |
| 15 | + with open(os.path.join(base_path, "pyproject.toml.update"), "r") as fp: |
| 16 | + pyproject_toml_update = tomlkit.load(fp) |
13 | 17 |
|
14 | | -# TODO How deep is your merge? |
15 | | -# Is merging on the tool level appropriate? |
16 | | -pyproject_toml["tool"].update(pyproject_toml_update["tool"]) |
| 18 | + # TODO How deep is your merge? |
| 19 | + # Is merging on the tool level appropriate? |
| 20 | + pyproject_toml["tool"].update(pyproject_toml_update["tool"]) |
17 | 21 |
|
18 | | -# Remove legacy tools. |
19 | | -for tool in ["flake8", "black", "isort"]: |
20 | | - pyproject_toml["tool"].pop(tool, None) |
| 22 | + # Remove legacy tools. |
| 23 | + for tool in ["flake8", "black", "isort"]: |
| 24 | + pyproject_toml["tool"].pop(tool, None) |
21 | 25 |
|
22 | | -with open("pyproject.toml", "w") as fp: |
23 | | - tomlkit.dump(pyproject_toml, fp) |
| 26 | + with open(os.path.join(base_path, "pyproject.toml"), "w") as fp: |
| 27 | + tomlkit.dump(pyproject_toml, fp) |
24 | 28 |
|
25 | 29 | # Remove unwanted files |
26 | 30 |
|
|
31 | 35 | {%- if not cookiecutter.glue %} |
32 | 36 | "pulp-glue{{ cookiecutter.__app_label_suffix }}", |
33 | 37 | "CHANGES/pulp-glue{{ cookiecutter.__app_label_suffix }}", |
| 38 | + {%- else %} |
| 39 | + "pulp-glue{{ cookiecutter.__app_label_suffix }}/pyproject.toml.update", |
34 | 40 | {%- endif %} |
35 | 41 | {%- if not cookiecutter.app_label or not cookiecutter.glue %} |
36 | 42 | ".ci/scripts/check_cli_dependencies.py", |
|
0 commit comments