2626from pathlib import Path
2727import tomlkit
2828
29- crates = {
30- 'datafusion-common' : 'datafusion/common/Cargo.toml' ,
31- 'datafusion-common-runtime' : 'datafusion/common-runtime/Cargo.toml' ,
32- 'datafusion' : 'datafusion/core/Cargo.toml' ,
33- 'datafusion-execution' : 'datafusion/execution/Cargo.toml' ,
34- 'datafusion-expr' : 'datafusion/expr/Cargo.toml' ,
35- 'datafusion-ffi' : 'datafusion/ffi/Cargo.toml' ,
36- 'datafusion-functions' : 'datafusion/functions/Cargo.toml' ,
37- 'datafusion-functions-aggregate' : 'datafusion/functions-aggregate/Cargo.toml' ,
38- 'datafusion-functions-nested' : 'datafusion/functions-nested/Cargo.toml' ,
39- 'datafusion-optimizer' : 'datafusion/optimizer/Cargo.toml' ,
40- 'datafusion-physical-expr' : 'datafusion/physical-expr/Cargo.toml' ,
41- 'datafusion-physical-expr-common' : 'datafusion/physical-expr-common/Cargo.toml' ,
42- 'datafusion-physical-plan' : 'datafusion/physical-plan/Cargo.toml' ,
43- 'datafusion-proto' : 'datafusion/proto/Cargo.toml' ,
44- 'datafusion-sql' : 'datafusion/sql/Cargo.toml' ,
45- 'datafusion-sqllogictest' : 'datafusion/sqllogictest/Cargo.toml' ,
46- 'datafusion-substrait' : 'datafusion/substrait/Cargo.toml' ,
47- 'datafusion-wasmtest' : 'datafusion/wasmtest/Cargo.toml' ,
48- 'datafusion-benchmarks' : 'benchmarks/Cargo.toml' ,
49- 'datafusion-cli' : 'datafusion-cli/Cargo.toml' ,
50- 'datafusion-examples' : 'datafusion-examples/Cargo.toml' ,
51- }
5229
5330def update_workspace_version (new_version : str ):
5431 cargo_toml = 'Cargo.toml'
@@ -64,47 +41,15 @@ def update_workspace_version(new_version: str):
6441
6542 doc = tomlkit .parse (data )
6643
67- for crate in crates .keys ():
68- df_dep = doc .get ('workspace' ).get ('dependencies' , {}).get (crate )
44+ for crate , df_dep in doc ['workspace' ]['dependencies' ].items ():
45+ if not crate .startswith ('datafusion' ):
46+ continue
6947 # skip crates that pin datafusion using git hash
7048 if df_dep is not None and df_dep .get ('version' ) is not None :
7149 print (f'updating { crate } dependency in { cargo_toml } ' )
7250 df_dep ['version' ] = new_version
7351
74- with open (cargo_toml , 'w' ) as f :
75- f .write (tomlkit .dumps (doc ))
76-
77-
78- def update_datafusion_version (cargo_toml : str , new_version : str ):
79- print (f'updating { cargo_toml } ' )
80- with open (cargo_toml ) as f :
81- data = f .read ()
82-
83- doc = tomlkit .parse (data )
84- pkg = doc .get ('package' )
85- if 'workspace' not in pkg ['version' ]:
86- pkg ['version' ] = new_version
87-
88- with open (cargo_toml , 'w' ) as f :
89- f .write (tomlkit .dumps (doc ))
90-
91- def update_downstream_versions (cargo_toml : str , new_version : str ):
92- with open (cargo_toml ) as f :
93- data = f .read ()
94-
95- doc = tomlkit .parse (data )
96-
97- for crate in crates .keys ():
98- df_dep = doc .get ('dependencies' , {}).get (crate )
99- # skip crates that pin datafusion using git hash
100- if df_dep is not None and df_dep .get ('version' ) is not None :
101- print (f'updating { crate } dependency in { cargo_toml } ' )
102- df_dep ['version' ] = new_version
103-
104- df_dep = doc .get ('dev-dependencies' , {}).get (crate )
105- if df_dep is not None and df_dep .get ('version' ) is not None :
106- print (f'updating { crate } dev-dependency in { cargo_toml } ' )
107- df_dep ['version' ] = new_version
52+ doc ['workspace' ]['package' ]['version' ] = new_version
10853
10954 with open (cargo_toml , 'w' ) as f :
11055 f .write (tomlkit .dumps (doc ))
@@ -117,6 +62,7 @@ def update_docs(path: str, new_version: str):
11762 fd .seek (0 )
11863 content = re .sub (r'datafusion\s*=\s*"(.+?)"' , f'datafusion = "{ new_version } "' , content )
11964 content = re .sub (r'datafusion\s*=\s*\{\s*version\s*=\s*"(.+?)"' , f'datafusion = {{ version = "{ new_version } "' , content )
65+ content = re .sub (r'datafusion version \d+\.\d+\.\d+' , f'datafusion version { new_version } ' , content )
12066 fd .truncate ()
12167 fd .write (content )
12268
@@ -151,18 +97,11 @@ def main():
15197 print (f'Updating workspace in { repo_root } to { new_version } ' )
15298 update_workspace_version (new_version )
15399
154- print (f'Updating datafusion crate versions in { repo_root } to { new_version } ' )
155- for cargo_toml in crates .values ():
156- update_datafusion_version (cargo_toml , new_version )
157-
158- print (f'Updating datafusion dependency versions in { repo_root } to { new_version } ' )
159- for cargo_toml in crates .values ():
160- update_downstream_versions (cargo_toml , new_version )
161-
162100 update_docs ("README.md" , new_version )
163101 update_docs ("docs/source/download.md" , new_version )
164102 update_docs ("docs/source/user-guide/example-usage.md" , new_version )
165103 update_docs ("docs/source/user-guide/crate-configuration.md" , new_version )
104+ update_docs ("docs/source/user-guide/configs.md" , new_version )
166105
167106 update_ci (new_version )
168107
0 commit comments