@@ -131,7 +131,7 @@ function validate_manifest(julia_version::Union{Nothing,VersionNumber}, manifest
131131end
132132
133133function Manifest (raw:: Dict , f_or_io:: Union{String, IO} ):: Manifest
134- julia_version = raw[ " julia_version" ] == " nothing " ? nothing : VersionNumber (raw[" julia_version" ])
134+ julia_version = haskey ( raw, " julia_version" ) ? VersionNumber (raw[" julia_version" ]) : nothing
135135 manifest_format = VersionNumber (raw[" manifest_format" ])
136136 if ! in (manifest_format. major, 1 : 2 )
137137 if f_or_io isa IO
@@ -193,16 +193,16 @@ function read_manifest(f_or_io::Union{String, IO})
193193 rethrow ()
194194 end
195195 if Base. is_v1_format_manifest (raw)
196- raw = convert_flat_format_manifest (raw)
196+ raw = convert_v1_format_manifest (raw)
197197 end
198198 return Manifest (raw, f_or_io)
199199end
200200
201- function convert_flat_format_manifest (old_raw_manifest:: Dict )
201+ function convert_v1_format_manifest (old_raw_manifest:: Dict )
202202 new_raw_manifest = Dict {String, Any} (
203203 " deps" => old_raw_manifest,
204- " julia_version" => " nothing" , # must be a string here to match raw dict
205204 " manifest_format" => " 1.0.0" # must be a string here to match raw dict
205+ # don't set julia_version as it is unknown in old manifests
206206 )
207207 return new_raw_manifest
208208end
@@ -229,7 +229,9 @@ function destructure(manifest::Manifest)::Dict
229229 raw = Dict {String,Vector{Dict{String,Any}}} ()
230230 elseif manifest. manifest_format. major == 2
231231 raw = Dict {String,Any} ()
232- raw[" julia_version" ] = manifest. julia_version
232+ if ! isnothing (manifest. julia_version) # don't write julia_version if nothing
233+ raw[" julia_version" ] = manifest. julia_version
234+ end
233235 raw[" manifest_format" ] = string (manifest. manifest_format. major, " ." , manifest. manifest_format. minor)
234236 raw[" deps" ] = Dict {String,Vector{Dict{String,Any}}} ()
235237 for (k, v) in manifest. other
0 commit comments