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

update install location & add systemwide option #12

Merged
merged 31 commits into from
Dec 6, 2021
Merged

Conversation

LilithHafner
Copy link
Owner

@LilithHafner LilithHafner commented Dec 4, 2021

fixes #7

@codecov-commenter
Copy link

codecov-commenter commented Dec 4, 2021

Codecov Report

Merging #12 (dbe90e6) into main (08ab856) will decrease coverage by 2.72%.
The diff coverage is 81.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #12      +/-   ##
==========================================
- Coverage   84.37%   81.64%   -2.73%     
==========================================
  Files           1        1              
  Lines         128      158      +30     
==========================================
+ Hits          108      129      +21     
- Misses         20       29       +9     
Impacted Files Coverage Δ
src/UpdateJulia.jl 81.64% <81.63%> (-2.73%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 08ab856...dbe90e6. Read the comment docs.

@LilithHafner
Copy link
Owner Author

LilithHafner commented Dec 4, 2021

This PR was complicated by the fact that install_location and default_install_location expand the scope of testing to include

  • installing into a directory that doesn't exist
  • linking to a bin that doesn't exist
  • linking to a bin that isn't on path
  • adding a directory with spaces as bin on windows

@LilithHafner
Copy link
Owner Author

The issue was passing an invalid set_default=true keyword argument on windows, we now gracefully ignore that argument with a warning.

Comment on lines 21 to 44
function default_install_location(systemwide, v)
default = if systemwide
@os "\\Program Files" "/Applications" "/opt"
else
(joinpath(homedir(), (@os "AppData\\Local\\Programs" "Applications" ".local")))
end
current = dirname(dirname(
@static Sys.isapple() ? dirname(dirname(dirname(Base.Sys.BINDIR))) : Base.Sys.BINDIR))

if current == default || (@static Sys.isunix() && (@static !Sys.isapple() && startswith(current, "/opt/julia")))
current
else
println("julia-$VERSION is currently installed in $current. Install julia-$v in $default instead? Y/n")
response = readline(stdin)
if isempty(response) || uppercase(first(response)) == 'Y'
default
elseif uppercase(first(response)) == 'N'
current
else
error("Unknown input: $response. Expected 'y' or 'n'.")
end
end
end

Copy link
Owner Author

Choose a reason for hiding this comment

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

Discussed in #7

Comment on lines +70 to +73
set_default = (@static Sys.iswindows() ? false : v==latest()),
systemwide = !startswith(Base.Sys.BINDIR, homedir()),
install_location = default_install_location(systemwide, v),
bin = (@static Sys.iswindows() ? nothing : (systemwide ? "/usr/local/bin" : joinpath(homedir(), ".local/bin"))),
Copy link
Owner Author

Choose a reason for hiding this comment

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

Discussed in #7

@LilithHafner
Copy link
Owner Author

Need to document this behavior!

@LilithHafner LilithHafner merged commit fd13515 into main Dec 6, 2021
LilithHafner added a commit that referenced this pull request Dec 6, 2021
@LilithHafner LilithHafner deleted the install-location branch December 7, 2021 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mkdir("/opt/julias"; mode=0o777): permission denied (EACCES)
2 participants