1
1
# Set up a temporary environment just to run this script
2
2
using Pkg
3
- Pkg. activate (temp= true )
3
+ Pkg. activate (temp = true )
4
4
Pkg. add ([" YAML" , " TOML" , " JSON" , " HTTP" ])
5
5
import YAML
6
6
import TOML
18
18
19
19
function major_minor_patch_match (vs... )
20
20
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
+ )
22
25
end
23
26
24
27
"""
@@ -34,7 +37,10 @@ function update_project_toml(filename, target_version::VersionNumber)
34
37
open (filename, " w" ) do io
35
38
for line in lines
36
39
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
+ )
38
44
else
39
45
println (io, line)
40
46
end
@@ -54,7 +60,10 @@ function update_quarto_yml(filename, target_version::VersionNumber)
54
60
for line in lines
55
61
m = match (r" ^(\s +)- text:\s *\" v\d +\.\d +\"\s *$" , line)
56
62
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
+ )
58
67
else
59
68
println (io, line)
60
69
end
@@ -108,7 +117,7 @@ if ENV["TARGET_IS_MAIN"] == "true"
108
117
old_env = Pkg. project (). path
109
118
Pkg. activate (" ." )
110
119
try
111
- Pkg. add (name= " Turing" , version= latest_version)
120
+ Pkg. add (name = " Turing" , version = latest_version)
112
121
catch e
113
122
# If the Manifest couldn't be updated, the error will be shown later
114
123
println (e)
@@ -118,14 +127,20 @@ if ENV["TARGET_IS_MAIN"] == "true"
118
127
manifest_toml = TOML. parsefile (MANIFEST_TOML_PATH)
119
128
manifest_version = VersionNumber (manifest_toml[" deps" ][" Turing" ][1 ][" version" ])
120
129
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
+ )
122
134
end
123
135
end
124
136
125
137
if isempty (errors)
126
138
println (" All good" )
127
139
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
+ )
129
144
end
130
145
131
146
else
@@ -135,10 +150,12 @@ else
135
150
# work as it would involve paging through the list of releases). Instead,
136
151
# we just check that the minor versions match.
137
152
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
+ )
143
160
end
144
161
end
0 commit comments