|
1 | 1 | from packaging.specifiers import SpecifierSet |
2 | 2 | from typing import Sequence, cast |
3 | | -from pathlib import Path |
4 | 3 | import datetime |
5 | | -from os import walk |
6 | 4 |
|
7 | 5 | from spec_zero_tools.versions import repr_spec_set, tighten_lower_bound |
8 | 6 | from spec_zero_tools.parsing import ( |
|
18 | 16 | from packaging.version import Version |
19 | 17 |
|
20 | 18 |
|
21 | | -__all__ = ["read_schedule", "read_toml", "write_toml", "update_pyproject_toml", "discover_project_toml"] |
| 19 | +__all__ = ["read_schedule", "read_toml", "write_toml", "update_pyproject_toml"] |
22 | 20 |
|
23 | 21 | def update_pyproject_dependencies(dependencies: dict, schedule: SupportSchedule): |
24 | 22 | # iterate by idx because we want to update it inplace |
@@ -115,29 +113,6 @@ def update_pyproject_toml( |
115 | 113 | pyproject_data["project"]["dependencies"], new_version |
116 | 114 | ) |
117 | 115 |
|
118 | | - pixi_data = pyproject_data["tool"]["pixi"] |
119 | | - update_pixi_dependencies(pixi_data, new_version) |
120 | | - |
121 | | -def discover_project_toml(path: str | Path | None) -> Path: |
122 | | - |
123 | | - if path is None: |
124 | | - path = Path(".") |
125 | | - elif isinstance(path, str): |
126 | | - path = cast(Path, Path(path)) |
127 | | - |
128 | | - if path.is_file(): |
129 | | - |
130 | | - if path.exists(): |
131 | | - return path |
132 | | - else: |
133 | | - raise ValueError(f"{path} was supplied as path to project file but it did not exist") |
134 | | - |
135 | | - |
136 | | - for root, _, files in walk(path): |
137 | | - for file in files: |
138 | | - if file == "pyproject.toml": |
139 | | - return Path(root)/file |
140 | | - |
141 | | - raise RuntimeError("Could not find a pyproject.toml") |
142 | | - |
143 | | - |
| 116 | + if "tool" in pyproject_data and "pixi" in pyproject_data['tool']: |
| 117 | + pixi_data = pyproject_data["tool"]["pixi"] |
| 118 | + update_pixi_dependencies(pixi_data, new_version) |
0 commit comments