diff --git a/dist/linux/pyj b/dist/linux/pyj new file mode 100644 index 0000000..3717007 --- /dev/null +++ b/dist/linux/pyj @@ -0,0 +1,3 @@ +PYJAVA_PATH=$(command -v pyjava.jar | cut -d' ' -f2) +java -jar "$PYJAVA_PATH" "$@" && +python "${1%.pyj}.py" \ No newline at end of file diff --git a/dist/readme b/dist/readme new file mode 100644 index 0000000..bc17efa --- /dev/null +++ b/dist/readme @@ -0,0 +1,5 @@ +1. Put corresponding to your os file pyj into needed directory +2. Add path/to/pyjava.jar, path/to/java.exe, path/to/python.exe into $PATH env var +3. Make pyj cmdlet (e.g. using chmod +x) +4. Use it like pyj script.pyj +5. It will automatically compile it with PyJava and run with Python \ No newline at end of file diff --git a/dist/windows/pyj b/dist/windows/pyj new file mode 100644 index 0000000..c26408a --- /dev/null +++ b/dist/windows/pyj @@ -0,0 +1,6 @@ +@echo off +for /f "tokens=2" %%a in ('where /R %~dp0 pyjava.jar') do set PYJAVA_PATH=%%a +java.exe -jar "%PYJAVA_PATH%" %* && ( + set PY_SCRIPT=%1 + python.exe "%PY_SCRIPT:.pyj=.py%" +) diff --git a/dist/wsl/pyj b/dist/wsl/pyj new file mode 100644 index 0000000..4d6d2b6 --- /dev/null +++ b/dist/wsl/pyj @@ -0,0 +1,4 @@ +PYJAVA_PATH=$(whereis -b pyjava.jar | cut -d' ' -f2) +PYJAVA_PATH=$(echo "$PYJAVA_PATH" | sed -E 's|/mnt/([a-z])/|\1:/|') +java.exe -jar "$PYJAVA_PATH" "$@" && +python.exe "${1%.pyj}.py" \ No newline at end of file