-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make it easier to review Julia manifest updates (#2069)
This should put the output of `] update` and `status --outdated` in the PR body, so we can easily see what changed and what is stuck. Without this it looks like #1990. With this it looks like [#2070](#2070).
- Loading branch information
Showing
3 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import Pkg | ||
|
||
const IS_INSTALLED = r"\s*Installed (.+)" | ||
const DETAILS_BEGIN = """ | ||
<details> | ||
<summary> | ||
All package versions | ||
</summary> | ||
``` | ||
""" | ||
|
||
""" | ||
Update the Julia Manifest.toml and show the changes as well as outdated packages. | ||
The output is written to a file that can be used as the body of a pull request. | ||
""" | ||
function (@main)(_) | ||
path = normpath(@__DIR__, "../.pixi/update-manifest-julia.md") | ||
redirect_stdio(; stdout = path, stderr = path) do | ||
println("Update the Julia Manifest.toml to get the latest dependencies.\n") | ||
println("__Changed packages__\n```") | ||
Pkg.update() | ||
println("```\n\n__Packages still outdated after update__\n```") | ||
Pkg.status(; outdated = true) | ||
println("```") | ||
end | ||
|
||
# The Pkg.update output first prints all installed package versions. | ||
# This is a lot, strip it out, sort it, and put it in a details tag at the end. | ||
installed_lines = String[] | ||
lines = readlines(path) | ||
open(path, "w") do io | ||
for line in lines | ||
m = match(IS_INSTALLED, line) | ||
if m === nothing | ||
println(io, line) | ||
else | ||
push!(installed_lines, only(m.captures)) | ||
end | ||
end | ||
|
||
println(io, DETAILS_BEGIN) | ||
sort!(installed_lines) | ||
foreach(line -> println(io, line), installed_lines) | ||
println("```\n\n</details>") | ||
end | ||
end |