@@ -129,7 +129,7 @@ function validate_manifest(julia_version::Union{Nothing,VersionNumber}, manifest
129129end
130130
131131function Manifest (raw:: Dict , f_or_io:: Union{String, IO} ):: Manifest
132- julia_version = raw[ " julia_version" ] == " nothing " ? nothing : VersionNumber (raw[" julia_version" ])
132+ julia_version = haskey ( raw, " julia_version" ) ? VersionNumber (raw[" julia_version" ]) : nothing
133133 manifest_format = VersionNumber (raw[" manifest_format" ])
134134 if ! in (manifest_format. major, 1 : 2 )
135135 if f_or_io isa IO
@@ -203,16 +203,16 @@ function read_manifest(f_or_io::Union{String,IO})
203203 pkgerror (" Could not parse manifest: " , sprint (showerror, raw))
204204 end
205205 if is_v1_format_manifest (raw)
206- raw = convert_flat_format_manifest (raw)
206+ raw = convert_v1_format_manifest (raw)
207207 end
208208 return Manifest (raw, f_or_io)
209209end
210210
211- function convert_flat_format_manifest (old_raw_manifest:: Dict )
211+ function convert_v1_format_manifest (old_raw_manifest:: Dict )
212212 new_raw_manifest = Dict {String, Any} (
213213 " deps" => old_raw_manifest,
214- " julia_version" => " nothing" , # must be a string here to match raw dict
215214 " manifest_format" => " 1.0.0" # must be a string here to match raw dict
215+ # don't set julia_version as it is unknown in old manifests
216216 )
217217 return new_raw_manifest
218218end
@@ -239,7 +239,9 @@ function destructure(manifest::Manifest)::Dict
239239 raw = Dict {String,Vector{Dict{String,Any}}} ()
240240 elseif manifest. manifest_format. major == 2
241241 raw = Dict {String,Any} ()
242- raw[" julia_version" ] = manifest. julia_version
242+ if ! isnothing (manifest. julia_version) # don't write julia_version if nothing
243+ raw[" julia_version" ] = manifest. julia_version
244+ end
243245 raw[" manifest_format" ] = string (manifest. manifest_format. major, " ." , manifest. manifest_format. minor)
244246 raw[" deps" ] = Dict {String,Vector{Dict{String,Any}}} ()
245247 for (k, v) in manifest. other
0 commit comments