Skip to content

Commit cdee09d

Browse files
authored
Merge pull request #41 from gpilab/develop
Handle PATH requirements for GPI launched outside of an active conda environment
2 parents c1f5987 + 36b5de2 commit cdee09d

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

launch/gpi.command

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ fi
3535
ANACONDA=/opt/anaconda1anaconda2anaconda3
3636
PYTHON=${ANACONDA}/bin/python
3737
GPI_LAUNCH=${ANACONDA}/bin/gpi_launch
38-
WIN_PYTHON=${ANACONDA}/python
39-
WIN_GPI_LAUNCH=${ANACONDA}/Scripts/gpi_launch
38+
39+
BINDIR="$ANACONDA/bin"
40+
if ! echo $PATH | grep -q $BINDIR ; then
41+
PATH="${BINDIR}:${PATH}"
42+
fi
4043

4144
GPI_LINK=/tmp/GPI
4245

@@ -49,7 +52,7 @@ elif [ "$(uname)" == "Linux" ]; then
4952
$PYTHON $GPI_LAUNCH -style cleanlooks $@
5053
# Windows
5154
else
52-
$WIN_PYTHON -u $WIN_GPI_LAUNCH -style Windows $@
55+
python -u gpi_launch -style Windows $@
5356
fi
5457

5558

launch/gpi_cmd.bat

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@echo off
2-
2+
setlocal
33
:: Copyright (C) 2014 Dignity Health
44
::
55
:: This program is free software: you can redistribute it and/or modify
@@ -24,15 +24,26 @@
2424
:: MAKES NO WARRANTY AND HAS NO LIABILITY ARISING FROM ANY USE OF THE
2525
:: SOFTWARE IN ANY HIGH RISK OR STRICT LIABILITY ACTIVITIES.
2626

27-
:: The GPI launcher script. The .command suffix is used by OSX open.
28-
29-
:: get user environment settings
30-
:: -this will pickup the user's visual editor
27+
:: The GPI launcher script for Windows installations.
3128

3229
set ANACONDA=/opt/anaconda1anaconda2anaconda3
3330
set PYTHON=%ANACONDA%\python
3431
set GPI_LAUNCH=%ANACONDA%\Scripts\gpi_launch
3532

36-
%PYTHON% %GPI_LAUNCH% -style Windows %*
33+
:: Add needed folders to the path if launching from outside an active conda
34+
set ANACONDA_WIN=%ANACONDA:/=\%
35+
echo %PATH% | findstr %ANACONDA_WIN% > NUL
36+
if %ERRORLEVEL% NEQ 0 goto :fixpath
37+
goto :endif
3738

39+
:fixpath
40+
set PATH=%ANACONDA_WIN%\bin;%PATH%
41+
set PATH=%ANACONDA_WIN%\Scripts;%PATH%
42+
set PATH=%ANACONDA_WIN%\Library\bin;%PATH%
43+
set PATH=%ANACONDA_WIN%\Library\usr\bin;%PATH%
44+
set PATH=%ANACONDA_WIN%\Library\mingw-w64\bin;%PATH%
45+
set PATH=%ANACONDA_WIN%;%PATH%
46+
:endif
47+
48+
%PYTHON% %GPI_LAUNCH% -style Windows %*
3849

0 commit comments

Comments
 (0)