Skip to content

Commit 583fbb3

Browse files
committed
Update update_arrow_deps.py
1 parent b6898db commit 583fbb3

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

dev/update_arrow_deps.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,20 @@ def update_version_cargo_toml(cargo_toml, new_version):
8888

8989
for section in ("dependencies", "dev-dependencies"):
9090
for (dep_name, constraint) in doc.get(section, {}).items():
91-
if dep_name in ("arrow", "parquet", "arrow-flight") and constraint.get("version") is not None:
92-
doc[section][dep_name]["version"] = new_version
91+
if dep_name in ("arrow", "parquet", "arrow-flight"):
92+
if type(constraint) == tomlkit.items.String:
93+
# handle constraint that is (only) a string like '12',
94+
doc[section][dep_name] = new_version
95+
elif type(constraint) == dict:
96+
# handle constraint that is itself a struct like
97+
# {'version': '12', 'features': ['prettyprint']}
98+
doc[section][dep_name]["version"] = new_version
99+
elif type(constraint) == tomlkit.items.InlineTable:
100+
# handle constraint that is itself a struct like
101+
# {'version': '12', 'features': ['prettyprint']}
102+
doc[section][dep_name]["version"] = new_version
103+
else:
104+
print("Unknown type for {} {}: {}", dep_name, constraint, type(constraint))
93105

94106
with open(cargo_toml, 'w') as f:
95107
f.write(tomlkit.dumps(doc))

0 commit comments

Comments
 (0)