11# Set up a temporary environment just to run this script
22using Pkg
3- Pkg. activate (temp= true )
3+ Pkg. activate (temp = true )
44Pkg. add ([" YAML" , " TOML" , " JSON" , " HTTP" ])
55import YAML
66import TOML
1818
1919function major_minor_patch_match (vs... )
2020 first = vs[1 ]
21- all (v.:major == first.:major && v.:minor == first.:minor && v.:patch == first.:patch for v in vs)
21+ all (
22+ v.:major == first.:major && v.:minor == first.:minor && v.:patch == first.:patch for
23+ v in vs
24+ )
2225end
2326
2427"""
@@ -34,7 +37,10 @@ function update_project_toml(filename, target_version::VersionNumber)
3437 open (filename, " w" ) do io
3538 for line in lines
3639 if occursin (r" ^Turing\s *=\s *\"\d +\.\d +\"\s *$" , line)
37- println (io, " Turing = \" $(target_version.:major ) .$(target_version.:minor ) \" " )
40+ println (
41+ io,
42+ " Turing = \" $(target_version.:major ) .$(target_version.:minor ) \" " ,
43+ )
3844 else
3945 println (io, line)
4046 end
@@ -54,7 +60,10 @@ function update_quarto_yml(filename, target_version::VersionNumber)
5460 for line in lines
5561 m = match (r" ^(\s +)- text:\s *\" v\d +\.\d +\"\s *$" , line)
5662 if m != = nothing
57- println (io, " $(m[1 ]) - text: \" v$(target_version.:major ) .$(target_version.:minor ) \" " )
63+ println (
64+ io,
65+ " $(m[1 ]) - text: \" v$(target_version.:major ) .$(target_version.:minor ) \" " ,
66+ )
5867 else
5968 println (io, line)
6069 end
@@ -108,7 +117,7 @@ if ENV["TARGET_IS_MAIN"] == "true"
108117 old_env = Pkg. project (). path
109118 Pkg. activate (" ." )
110119 try
111- Pkg. add (name= " Turing" , version= latest_version)
120+ Pkg. add (name = " Turing" , version = latest_version)
112121 catch e
113122 # If the Manifest couldn't be updated, the error will be shown later
114123 println (e)
@@ -118,14 +127,20 @@ if ENV["TARGET_IS_MAIN"] == "true"
118127 manifest_toml = TOML. parsefile (MANIFEST_TOML_PATH)
119128 manifest_version = VersionNumber (manifest_toml[" deps" ][" Turing" ][1 ][" version" ])
120129 if ! major_minor_patch_match (latest_version, manifest_version)
121- push! (errors, " Failed to update $(MANIFEST_TOML_PATH) to match latest Turing.jl version" )
130+ push! (
131+ errors,
132+ " Failed to update $(MANIFEST_TOML_PATH) to match latest Turing.jl version" ,
133+ )
122134 end
123135 end
124136
125137 if isempty (errors)
126138 println (" All good" )
127139 else
128- error (" The following errors occurred during version checking: \n " , join (errors, " \n " ))
140+ error (
141+ " The following errors occurred during version checking: \n " ,
142+ join (errors, " \n " ),
143+ )
129144 end
130145
131146else
@@ -135,10 +150,12 @@ else
135150 # work as it would involve paging through the list of releases). Instead,
136151 # we just check that the minor versions match.
137152 if ! major_minor_match (quarto_version, project_version, manifest_version)
138- error (" The minor versions of Turing.jl in _quarto.yml, Project.toml, and Manifest.toml are inconsistent:
139- - _quarto.yml: $quarto_version_str
140- - Project.toml: $project_version_str
141- - Manifest.toml: $manifest_version
142- " )
153+ error (
154+ " The minor versions of Turing.jl in _quarto.yml, Project.toml, and Manifest.toml are inconsistent:
155+ - _quarto.yml: $quarto_version_str
156+ - Project.toml: $project_version_str
157+ - Manifest.toml: $manifest_version
158+ " ,
159+ )
143160 end
144161end
0 commit comments