alamb commented on a change in pull request #874:
URL: https://github.com/apache/arrow-datafusion/pull/874#discussion_r688914831
##########
File path: dev/update_arrow_deps.py
##########
@@ -55,29 +65,61 @@ def update_dependencies(dependencies, new_sha):
dep['rev'] = new_sha
-def update_cargo_toml(cargo_toml, new_sha):
+def update_commit_cargo_toml(cargo_toml, new_sha):
+ print('updating {}'.format(cargo_toml.absolute()))
+ with open(cargo_toml) as f:
+ data = f.read()
+
+ doc = tomlkit.parse(data)
+
+ update_commit_dependencies(doc.get('dependencies'), new_sha)
+ update_commit_dependencies(doc.get('dev-dependencies'), new_sha)
+
+ with open(cargo_toml, 'w') as f:
+ f.write(tomlkit.dumps(doc))
+
+
+def update_version_cargo_toml(cargo_toml, new_version):
print('updating {}'.format(cargo_toml.absolute()))
with open(cargo_toml) as f:
data = f.read()
doc = tomlkit.parse(data)
- update_dependencies(doc.get('dependencies'), new_sha)
- update_dependencies(doc.get('dev-dependencies'), new_sha)
+ for section in ("dependencies", "dev-dependencies"):
+ for (dep_name, constraint) in doc.get(section, {}).items():
+ if dep_name in ("arrow", "parquet", "arrow-flight") and
constraint.get("version") is not None:
+ doc[section][dep_name]["version"] = new_version
with open(cargo_toml, 'w') as f:
f.write(tomlkit.dumps(doc))
-# Begin main script
+def main():
+ parser = argparse.ArgumentParser(description='Update arrow dep versions.')
+ sub_parsers = parser.add_subparsers(help='sub-command help')
+
+ parser_version = sub_parsers.add_parser('version', help='update arrow
version')
+ parser_version.add_argument('new_version', type=str, help='new arrow
version')
+ parser_version.set_defaults(which='version')
+
+ parser_commit = sub_parsers.add_parser('commit', help='update arrow
commit')
Review comment:
this is neat
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]