Browse Source

add a script for syncing Project.toml with REQUIRE

pull/162/head
James Fairbanks 1 year ago
parent
commit
b87d73bfce
1 changed files with 32 additions and 0 deletions
  1. +32
    -0
      bin/update_require.jl

+ 32
- 0
bin/update_require.jl View File

@ -0,0 +1,32 @@
#!/usr/bin/env julia
######################################################################
# Overwrite REQUIRE using dependency information from Project.toml.
#
# Call from the root of the package repository.
#
# Has some basic sanity checks, but **use at your own risk**, `REQUIRE`
# will be overwritten.
######################################################################
import Pkg
const PT = Pkg.Types
Pkg.activate(pwd()) # current directory as the project
ctx = PT.Context()
pkg = ctx.env.pkg
if pkg nothing
@error "Not in a package, I won't generate REQUIRE."
exit(1)
else
@info "found package" pkg = pkg
end
deps = PT.get_deps(ctx)
non_std_deps = sort(collect(setdiff(keys(deps), values(ctx.stdlibs))))
open("REQUIRE", "w") do io
for d in non_std_deps
println(io, d)
@info "listing $d"
end
end

Loading…
Cancel
Save