diff --git a/README.md b/README.md
index b017bd3a..9ecd593f 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,14 @@
# Installing on Linux
-Download bash script to install [here](https://raw.githubusercontent.com/MetaCell/PsyNeuLinkView/feature/PSYNEU-140/package/linux_installer.sh).
+Download the installer from here and double click to run the installation.
+
+# Installing on MAC
+
+Download the installer from here and double click to run the installation.
+
+# Manual installation on Linux
+
+Download bash script to install [here](https://raw.githubusercontent.com/MetaCell/PsyNeuLinkView/develop/package/linux_installer.sh).
It's recommended to download it in your home directory.
On terminal, go to your home directory
@@ -39,9 +47,9 @@ psyneulinkviewer
The application should open up succesfully after this. An icon will be visible on the Desktop as well.
-# Installing on MAC
+# Manual installation on MAC
-Download bash script to install [here](https://raw.githubusercontent.com/MetaCell/PsyNeuLinkView/feature/PSYNEU-140/package/mac_installer.sh).
+Download bash script to install [here](https://raw.githubusercontent.com/MetaCell/PsyNeuLinkView/develop/package/mac_installer.sh).
It's recommended to download it in your home directory.
On terminal, go to your home directory
diff --git a/package/.linux_installer.sh.swp b/package/.linux_installer.sh.swp
deleted file mode 100644
index 730b11d1..00000000
Binary files a/package/.linux_installer.sh.swp and /dev/null differ
diff --git a/package/README.md b/package/README.md
index bbf53043..a62700f0 100644
--- a/package/README.md
+++ b/package/README.md
@@ -1,31 +1,44 @@
# Installing on Linux
+Download the installer from here and double click to run the installation.
+
+# Installing on MAC
+
+Download the installer from here and double click to run the installation.
+
+# Manual installation on Linux
+
Download bash script to install [here](https://raw.githubusercontent.com/MetaCell/PsyNeuLinkView/feature/PSYNEU-140/package/linux_installer.sh).
-It's recommended to download it in your home directory.
+It's recommended to download it in your home directory.
On terminal, go to your home directory
+
```
cd ~
```
Change file permissions to allow user to run it
+
```
chmod + x linux_installer.sh
```
-And run installer
+And run installer
+
```
./linux_installer.sh
```
After installation is done:
-If conda environment is already active, run
+If conda environment is already active, run
+
```
psyneulinkviewer
```
If conda environment is not active, then run :
+
```
source ~/.profile
conda activate psyneulinkview
@@ -34,34 +47,39 @@ psyneulinkviewer
The application should open up succesfully after this. An icon will be visible on the Desktop as well.
-# Installing on MAC
+# Manual installation on MAC
Download bash script to install [here](https://raw.githubusercontent.com/MetaCell/PsyNeuLinkView/feature/PSYNEU-140/package/mac_installer.sh).
-It's recommended to download it in your home directory.
+It's recommended to download it in your home directory.
On terminal, go to your home directory
+
```
cd ~
```
Give user permissions to file
+
```
chmod +x mac_installer.sh
```
-And run installer
+And run installer
+
```
./mac_installer.sh
```
After installation is done:
-If conda environment is already active, run
+If conda environment is already active, run
+
```
open ~/psyneulinkviewer-darwin-x64/psyneulinkviewer.app/
```
If conda environment is not active, then run :
+
```
source ~/.bash_profile
conda activate psyneulinkview
@@ -75,25 +93,29 @@ The application should open up succesfully after this. A desktop icon should be
The scripts above run the following commands in order:
Firs installs the python module 'psyneulinkviewer' from PyPi
+
```
sudo pip install psyneulinkviewer
```
+
This commands installs required libraries and packages. Also creates a conda enviroment where the needed packages are installed.
-After successfully installing the python package above, it reset the user's bash profile to apply the settings changes
+After successfully installing the python package above, it reset the user's bash profile to apply the settings changes
+
- Linux
+
```
source ~/.profile
```
-- Mac
+- Mac
+
```
source ~/.bash_profile
```
Then, a desktop file is created on the Desktop which allows users to open the application this way
-
# Psyneulinkviewer Requirements
Psyneulinkviewer requires:
@@ -113,11 +135,12 @@ If all went well with installation, you should see the application running as in
To test models, download [these models](https://github.com/MetaCell/PsyNeuLinkView/tree/feature/PSYNEU-140/test_models) and import one at a time to test. Each time a Model is open, the previous one will disappear. I recommend you start with the models inside 'working_tests', as those are the ones we know for sure should we working.
-To import go to File -> Open Models
+To import go to File -> Open Models
# PsyNeuLinkView Package Building
To build pip package
+
```
cd package
python3 -m pip install build
@@ -125,16 +148,19 @@ python3 -m build --sdist
```
To test local build
+
```
pip install dist/psyneulinkviewer-VERSIOn.tar.gz
```
-To upload to distribution server. You will need token shared privately to be able to upload.
+To upload to distribution server. You will need token shared privately to be able to upload.
+
```
python3 -m twine upload dist/*
```
To upload to test Pypi server
+
```
python3 -m twine upload --repository testpypi dist/*
```
diff --git a/package/installers/generate_linux_binary.sh b/package/installers/generate_linux_binary.sh
new file mode 100755
index 00000000..e1699cde
--- /dev/null
+++ b/package/installers/generate_linux_binary.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+shc -vrf linux.sh -o linux
diff --git a/package/installers/linux b/package/installers/linux
new file mode 100755
index 00000000..64dcd553
Binary files /dev/null and b/package/installers/linux differ
diff --git a/package/installers/linux.sh b/package/installers/linux.sh
new file mode 100755
index 00000000..ec6b4220
--- /dev/null
+++ b/package/installers/linux.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+RUN_FLAG=0
+
+if [ $RUN_FLAG -eq 0 ]; then
+ command -v xterm >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ xterm -fa 'Monospace' -fs 14 -hold -e "cd ~ && . .bashrc && curl -H \"Cache-Control: no-cache\" https://raw.githubusercontent.com/MetaCell/PsyNeuLinkView/develop/package/scripts/linux_installer.sh -o linux_installer.sh && chmod +x linux_installer.sh && ./linux_installer.sh && rm -f linux_installer.sh && bash"
+ RUN_FLAG=1
+ fi
+fi
+
+if [ $RUN_FLAG -eq 0 ]; then
+ command -v konsole >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ konsole --noclose -e "cd ~ && . .bashrc && curl -H \"Cache-Control: no-cache\" https://raw.githubusercontent.com/MetaCell/PsyNeuLinkView/develop/package/scripts/linux_installer.sh -o linux_installer.sh && chmod +x linux_installer.sh && ./linux_installer.sh && rm -f linux_installer.sh && bash"
+ RUN_FLAG=1
+ fi
+fi
+
+
+if [ $RUN_FLAG -eq 0 ]; then
+ command -v gnome-terminal >/dev/null
+ if [ $? -eq 0 ]; then
+ gnome-terminal -- bash -c "cd ~ && . .bashrc && curl -H \"Cache-Control: no-cache\" https://raw.githubusercontent.com/MetaCell/PsyNeuLinkView/develop/package/scripts/linux_installer.sh -o linux_installer.sh && chmod +x linux_installer.sh && ./linux_installer.sh && rm -f linux_installer.sh && bash"
+ RUN_FLAG=1
+ fi
+fi
+
+if [ $RUN_FLAG -eq 0 ]; then
+ command -v notify-send >/dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ notify-send "PsyNeuLinkViewer installation ERROR: No terminal found" "Try the manual installation documented in the github README."
+ else
+ xmessage -center -buttons 'Close':0 -default Ok -nearmouse "Error during the PsyNeuLinkViewer installation: No terminal found\nPlease try to download the linux installer bash script and run this manually from your terminal as documented in the repository README."
+ fi
+fi
diff --git a/package/installers/macos.scpt b/package/installers/macos.scpt
new file mode 100755
index 00000000..f2a06849
--- /dev/null
+++ b/package/installers/macos.scpt
@@ -0,0 +1,3 @@
+osascript -e 'tell app "Terminal"
+ do script "cd ~ && curl -H \"Cache-Control: no-cache\" https://raw.githubusercontent.com/MetaCell/PsyNeuLinkView/develop/package/scripts/mac_installer.sh -o mac_installer.sh && chmod +x mac_installer.sh && ./mac_installer.sh && rm -f mac_installer.sh"
+end tell' > /dev/null
diff --git a/package/linux_installer.sh b/package/scripts/linux_installer.sh
similarity index 83%
rename from package/linux_installer.sh
rename to package/scripts/linux_installer.sh
index 796c1f51..81c9d52a 100755
--- a/package/linux_installer.sh
+++ b/package/scripts/linux_installer.sh
@@ -1,5 +1,18 @@
#!/bin/bash
+
+check_last_command () {
+ if [[ $? -ne 0 ]]; then
+ echo ">>> Please report the output below to support@metacell.us <<<"
+ echo "Error: $1"
+ python --version
+ pip --version
+ conda --version
+ exit 1
+ fi
+}
+
pip install -vv psyneulinkviewer --break-system-packages --use-pep517 && . ~/.profile && sudo chown root:root /usr/local/bin/psyneulinkviewer-linux-x64/chrome-sandbox && sudo chmod 4755 /usr/local/bin/psyneulinkviewer-linux-x64/chrome-sandbox
+check_last_command
# Variables
APP_NAME="PsyneulinkViewer" # Name of the application
@@ -8,18 +21,8 @@ CONDA_ENV=$PSYNEULINK_ENV # Conda environment t
ICON_PATH="/usr/local/bin/psyneulinkviewer-linux-x64/resources/app/build/logo.png" # Path to the custom icon
DESKTOP_FILE="$HOME/Desktop/$APP_NAME.desktop" # Path where the desktop shortcut will be created
-# Function to check if a conda environment is already active
-is_conda_active() {
- if [[ -n "$CONDA_DEFAULT_ENV" ]]; then
- echo "Conda environment '$CONDA_DEFAULT_ENV' is already active."
- return 0
- else
- echo "No active conda environment found. Activating '$CONDA_ENV'..."
- return 1
- fi
-}
-
# Creating the .desktop file for the application
+rm -f "$DESKTOP_FILE"
echo "[Desktop Entry]" > "$DESKTOP_FILE"
echo "Version=1.0" >> "$DESKTOP_FILE"
echo "Name=$APP_NAME" >> "$DESKTOP_FILE"
diff --git a/package/mac_installer.sh b/package/scripts/mac_installer.sh
similarity index 87%
rename from package/mac_installer.sh
rename to package/scripts/mac_installer.sh
index 44ce4728..ea14ddb0 100755
--- a/package/mac_installer.sh
+++ b/package/scripts/mac_installer.sh
@@ -1,5 +1,18 @@
#!/bin/bash
+check_last_command () {
+ if [[ $? -ne 0 ]]; then
+ echo ">>> Please report the output below to support@metacell.us <<<"
+ echo "Error: $1"
+ python --version
+ pip --version
+ conda --version
+ exit 1
+ fi
+}
+
+
pip install -vv psyneulinkviewer --break-system-packages --use-pep517 && source ~/.bashrc_profile
+check_last_command
# Variables - adjust these for your setup
APP_PATH="$HOME/psyneulinkviewer-darwin-x64/psyneulinkviewer.app/" # Replace with the full path to the application
@@ -14,21 +27,12 @@ COMMAND_FILE_PATH="$APP_SHORTCUT_PATH/Contents/MacOS/$SHORTCUT_NAME"
ICON_FILE_PATH="$APP_SHORTCUT_PATH/Contents/Resources/$SHORTCUT_NAME.icns"
# Create .app structure
+rm -rf "$APP_SHORTCUT_PATH"
mkdir -p "$APP_SHORTCUT_PATH/Contents/MacOS"
mkdir -p "$APP_SHORTCUT_PATH/Contents/Resources"
-
-# Function to check if a conda environment is active
-is_conda_active() {
- # Check if the CONDA_DEFAULT_ENV variable is set, meaning a conda environment is active
- if [ -z "$CONDA_DEFAULT_ENV" ]; then
- return 1 # No active conda environment
- else
- return 0 # A conda environment is already active
- fi
-}
-
# Write the .command file that launches the app with conda environment
cat < "$COMMAND_FILE_PATH"
+
#!/bin/bash
source ~/.bashrc_profile
source ~/miniconda3/etc/profile.d/conda.sh
@@ -71,4 +75,3 @@ chmod -R 755 "$APP_SHORTCUT_PATH"
touch "$APP_SHORTCUT_PATH"
echo "Shortcut created at $DESKTOP_PATH/$SHORTCUT_NAME.app"
-