Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pkg: explain why rm is noop when attempting to remove a package that is dependency #4108

Merged
merged 1 commit into from
Aug 20, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions base/pkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ add(pkg::String, vers::VersionNumber...) = add(pkg, VersionSet(vers...))
init(meta::String=Dir.DEFAULT_META) = Dir.init(meta)

edit(f::Function, pkg, args...) = Dir.cd() do
msg = ""
r = Reqs.read("REQUIRE")
reqs = Reqs.parse(r)
avail = Read.available()
if !haskey(avail,pkg) && !haskey(reqs,pkg)
error("unknown package $pkg")
end
r_ = f(r,pkg,args...)
r_ == r && return info("Nothing to be done.")
r_ == r && begin
if (f == Reqs.rm) msg = " Cannot remove yet: $pkg is required by installed package." end
return info("Nothing to be done.$msg")
end
reqs_ = Reqs.parse(r_)
reqs_ != reqs && _resolve(reqs_,avail)
Reqs.write("REQUIRE",r_)
Expand Down Expand Up @@ -362,4 +366,4 @@ end
fixup() = Dir.cd(_fixup)
fixup(pkg) = Dir.cd(()->_fixup(pkg))

end # module
end # module