forked from PrincetonUniversity/PsyNeuLinkView
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #162 from MetaCell/feature/PSYNEU-140
PSYNEU-140 - Install MAC symlink on user directory to avoid Permissions Denied errors. Adds Desktop Icon as part of script installation #145
- Loading branch information
Showing
17 changed files
with
314 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,4 +48,6 @@ yalc.lock | |
#prettier config | ||
.prettierrc.json | ||
|
||
.idea | ||
.idea | ||
|
||
package/.eggs |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,46 @@ | ||
#!/usr/bin/env bash -l | ||
pip install -vv psyneulinkviewer && source ~/.profile && conda activate psyneulinkview && psyneulinkviewer | ||
#!/bin/bash | ||
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 | ||
|
||
# Variables | ||
APP_NAME="PsyneulinkViewer" # Name of the application | ||
SYMLINK_PATH="psyneulinkviewer" # Symlink to the application you want to launch | ||
CONDA_ENV=$PSYNEULINK_ENV # Conda environment to activate if none is active | ||
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 | ||
echo "[Desktop Entry]" > "$DESKTOP_FILE" | ||
echo "Version=1.0" >> "$DESKTOP_FILE" | ||
echo "Name=$APP_NAME" >> "$DESKTOP_FILE" | ||
|
||
# Create the Exec command: Check if conda environment is active, if not activate the specified one | ||
echo "Exec=bash -c '. ~/miniconda3/etc/profile.d/conda.sh && \ | ||
conda activate $CONDA_ENV && \ | ||
$SYMLINK_PATH'" >> "$DESKTOP_FILE" | ||
|
||
# Set the custom icon | ||
echo "Icon=$ICON_PATH" >> "$DESKTOP_FILE" | ||
echo "Type=Application" >> "$DESKTOP_FILE" | ||
echo "Terminal=false" >> "$DESKTOP_FILE" | ||
echo "Categories=Application;" >> "$DESKTOP_FILE" | ||
|
||
APP_DESKTOP="$HOME/.local/share/applications/$APP_NAME.desktop" | ||
|
||
cp "$DESKTOP_FILE" "$APP_DESKTOP" | ||
# Make the .desktop file executable | ||
chmod +x "$DESKTOP_FILE" | ||
rm "$DESKTOP_FILE" | ||
chmod +x "$APP_DESKTOP" | ||
|
||
echo "Application shortcut created at $APP_DESKTOP" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,74 @@ | ||
#!/usr/bin/env bash -l | ||
pip install -vv psyneulinkviewer --break-system-packages && source ~/.bash_profile && conda activate psyneulinkview && open /usr/local/bin/psyneulinkviewer-darwin-x64/psyneulinkviewer.app/ | ||
#!/bin/bash | ||
pip install -vv psyneulinkviewer --break-system-packages --use-pep517 && source ~/.bashrc_profile | ||
|
||
# Variables - adjust these for your setup | ||
APP_PATH="$HOME/psyneulinkviewer-darwin-x64/psyneulinkviewer.app/" # Replace with the full path to the application | ||
CONDA_ENV=$PSYNEULINK_ENV # Replace with your Conda environment name | ||
ICON_PATH="$HOME/psyneulinkviewer-darwin-x64/psyneulinkviewer.app/Contents/Resources/electron.icns" # Replace with the full path to your custom icon (should be in .icns format) | ||
SHORTCUT_NAME="PsyneulinkViewer" # Name for the desktop shortcut | ||
|
||
# Define paths | ||
DESKTOP_PATH="$HOME/Desktop" | ||
APP_SHORTCUT_PATH="$DESKTOP_PATH/$SHORTCUT_NAME.app" | ||
COMMAND_FILE_PATH="$APP_SHORTCUT_PATH/Contents/MacOS/$SHORTCUT_NAME" | ||
ICON_FILE_PATH="$APP_SHORTCUT_PATH/Contents/Resources/$SHORTCUT_NAME.icns" | ||
|
||
# Create .app structure | ||
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 <<EOL > "$COMMAND_FILE_PATH" | ||
#!/bin/bash | ||
source ~/.bashrc_profile | ||
source ~/miniconda3/etc/profile.d/conda.sh | ||
conda activate $CONDA_ENV | ||
open "$APP_PATH" | ||
EOL | ||
|
||
# Make the script executable | ||
chmod +x "$COMMAND_FILE_PATH" | ||
|
||
# Copy the custom icon | ||
cp "$ICON_PATH" "$ICON_FILE_PATH" | ||
|
||
# Create Info.plist for the app | ||
cat <<EOL > "$APP_SHORTCUT_PATH/Contents/Info.plist" | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleExecutable</key> | ||
<string>$SHORTCUT_NAME</string> | ||
<key>CFBundleIconFile</key> | ||
<string>$SHORTCUT_NAME</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.example.$SHORTCUT_NAME</string> | ||
<key>CFBundleName</key> | ||
<string>$SHORTCUT_NAME</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.0</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
</dict> | ||
</plist> | ||
EOL | ||
|
||
# Set the correct file permissions for the .app | ||
chmod -R 755 "$APP_SHORTCUT_PATH" | ||
|
||
# Touch the app to refresh Finder so it displays the correct icon | ||
touch "$APP_SHORTCUT_PATH" | ||
|
||
echo "Shortcut created at $DESKTOP_PATH/$SHORTCUT_NAME.app" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Metadata-Version: 2.1 | ||
Name: psyneulinkviewer | ||
Version: 0.4.8 | ||
Home-page: https://github.com/metacell/psyneulinkviewer | ||
Author: metacell | ||
Author-email: dev@metacell.us | ||
Requires-Python: >=3.7 | ||
License-File: LICENSE | ||
Requires-Dist: requests | ||
Requires-Dist: wget | ||
Requires-Dist: packaging<=24.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
LICENSE | ||
README.md | ||
setup.py | ||
psyneulinkviewer/__init__.py | ||
psyneulinkviewer/conda.py | ||
psyneulinkviewer/configuration.py | ||
psyneulinkviewer/node.py | ||
psyneulinkviewer/rosetta.py | ||
psyneulinkviewer/start.py | ||
psyneulinkviewer.egg-info/PKG-INFO | ||
psyneulinkviewer.egg-info/SOURCES.txt | ||
psyneulinkviewer.egg-info/dependency_links.txt | ||
psyneulinkviewer.egg-info/requires.txt | ||
psyneulinkviewer.egg-info/top_level.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
requests | ||
wget | ||
packaging<=24.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
psyneulinkviewer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.