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

Make an equivalent Linux script #1

Open
heetbeet opened this issue May 2, 2020 · 6 comments
Open

Make an equivalent Linux script #1

heetbeet opened this issue May 2, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@heetbeet
Copy link
Owner

heetbeet commented May 2, 2020

From https://www.reddit.com/r/Julia/comments/gbedwz/julia_windows_installation_script_with_batteries/fp7s8xl/

  • write python or bash code to replace the Windows .bat parts
  • get to the Julia part as fast as possible, and try to cross-platform generalise as much as poossible
  • maybe seperate the bat / julia / python code and allow the installer scripts to automatically get the julia part from github as a proper .jl file (added security issues).
  • get some bash glue going to replace the .bat entry points

This is a good template for the bash glue:

#--------------------------------------------------
# I might be a symlink, so here is my actual location
#--------------------------------------------------
#From https://stackoverflow.com/a/246128
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" 
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

#--------------------------------------------------
# Setup the environment variables and paths for Juliawin
#--------------------------------------------------
__environmentcode__

#--------------------------------------------------
# Finally, run this binary please
#--------------------------------------------------
"$DIR/__relativepathtobin__" "$@"
@heetbeet
Copy link
Owner Author

heetbeet commented May 2, 2020

If we really want to, we can have Batch, Python and Julia within one script, and tell Linux to run it as Python. It would feel strange to run a .bat extension in linux, but it works :P

#!/usr/bin/env python
""" 
clear
:: ========== Batch part ==========
@echo off

echo Hello world from bat
python "%~0"
julia "%~0"

exit /b 
"""
#=
# ========== Python part ==========
print("Hello world from Python")

""" 
=#
# ========== Julia part ==========
print("Hello world from Julia")

# """

@heetbeet
Copy link
Owner Author

heetbeet commented May 6, 2020

This is implemented, but not in main branch yet. There are also still some bugs to fix.

@heetbeet heetbeet closed this as completed May 6, 2020
@heetbeet heetbeet reopened this May 17, 2020
@heetbeet
Copy link
Owner Author

I removed all the linux parts for now untill I can focus on adding a proper linux implimentation

@heetbeet heetbeet added the enhancement New feature or request label May 18, 2020
@RoyiAvital
Copy link

RoyiAvital commented May 12, 2023

MacOS support will be great as well.

Maybe use PowerShell to support them all?

@heetbeet
Copy link
Owner Author

Since I've been able to only sparsely maintaining this project, I'm scaling back on extra features to rather focus on GitHub actions with a continual release cycle. Since I don't have a Mac, and since I don't have a linux port yet (which I think would be the first step for cross-platform use) I'm not going to put work into an MacOS release.

@RoyiAvital
Copy link

Once you have something for Linux I'd be happy to try helping on the macOS front.
Though, have you thought about using PowerShell? It might maje things easier for multi OS support, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants