Skip to content

Commit d59f7b2

Browse files
authored
fix dependencies for pyproject.toml (#42820)
1 parent da944c6 commit d59f7b2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

eng/tools/azure-sdk-tools/packaging_tools/generate_utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,18 @@ def generate_packaging_files(package_name, folder_name):
167167
setup_py.unlink()
168168

169169
call_build_config(package_name, folder_name)
170+
171+
# load pyproject.toml and replace "azure-core" with "azure-mgmt" (after codegen fix bug, we could remove this logic)
172+
if pyproject_toml.exists():
173+
with open(pyproject_toml, "rb") as f:
174+
pyproject_content = toml.load(f)
175+
if pyproject_content.get("project"):
176+
for idx in range(len(pyproject_content["project"].get("dependencies", []))):
177+
if pyproject_content["project"]["dependencies"][idx].startswith("azure-core"):
178+
pyproject_content["project"]["dependencies"][idx] = "azure-mgmt-core>=1.5.0"
179+
180+
with open(pyproject_toml, "wb") as f:
181+
tomlw.dump(pyproject_content, f)
170182
else:
171183
if not pyproject_toml.exists():
172184
with open(pyproject_toml, "w") as file_out:

0 commit comments

Comments
 (0)