Skip to content

Commit

Permalink
Merge pull request #12 from PALEOtoolkit/preferences_fix
Browse files Browse the repository at this point in the history
fix Parameter substitution from LocalPreferences.toml
  • Loading branch information
sjdaines authored May 2, 2022
2 parents 9de81e1 + cae6167 commit 24bbb46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PALEOboxes"
uuid = "804b410e-d900-4b2a-9ecd-f5a06d4c1fd4"
authors = ["Stuart Daines <[email protected]>"]
version = "0.17.0"
version = "0.17.1"

[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Expand Down
9 changes: 8 additions & 1 deletion src/Parameter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,15 @@ function substitutevalue(mod::Module, rawvalue::AbstractString; dontsub=("\$flux

# look up in LocalPreferences.toml
subval = m.match[2:end-1] # omit $ $

# if a Reaction is not part of a package (eg development code), use Preferences package instead to look for a key
if isnothing(Base.PkgId(mod).uuid)
@warn "substitutevalue $subval - Module $(mod) does not correspond to a loaded package, using a key from [PALEOboxes] instead"
mod = PALEOboxes
end

Preferences.has_preference(mod, String(subval)) ||
error("substitutevalue: key $subval not found in LocalPreferences.toml")
error("substitutevalue: key [$(Base.PkgId(mod).name)] $subval not found in LocalPreferences.toml")
replacestr = Preferences.load_preference(mod, String(subval))


Expand Down

2 comments on commit 24bbb46

@sjdaines
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/59524

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.17.1 -m "<description of version>" 24bbb464e9461d830c7245edab63094ec2dcaa8b
git push origin v0.17.1

Please sign in to comment.