Skip to content

Commit

Permalink
install shortcuts for windows in exec folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Sarahan committed Mar 28, 2016
1 parent 7583faa commit bc9ce3f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
15 changes: 9 additions & 6 deletions conda.recipe/bld.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
setlocal enabledelayedexpansion
set CONDA_DEFAULT_ENV=
%PYTHON% setup.py install
%PYTHON% setup.py install --old-and-unmanageable
if errorlevel 1 exit 1

del %SCRIPTS%\conda-init
Expand All @@ -9,18 +10,20 @@ if errorlevel 1 exit 1

:: link to exec folder as a more contained proxy. Idea is that people can add exec folder to PATH
:: instead of bin, and have only activate & conda on PATH - no trampling other stuff.
mkdir %PREFIX%/exec
mkdir %PREFIX%\exec

:: Assumes that you have some kind of bash on Windows active
for %%X in (bash.exe) do (set FOUND=%%~$PATH:X)
if defined FOUND (
bash -c "ln -s %PREFIX%/Scripts/activate %PREFIX%/exec/activate"
bash -c "ln -s %PREFIX%/Scripts/conda %PREFIX%/exec/conda"
set "FWD_PREFIX=%PREFIX:\=/%"
bash -c "ln -s !FWD_PREFIX!/Scripts/activate !FWD_PREFIX!/exec/activate"
bash -c "ln -s !FWD_PREFIX!/Scripts/conda.exe !FWD_PREFIX!/exec/conda.exe"
bash -c "ln -s !FWD_PREFIX!/Scripts/conda-script.py !FWD_PREFIX!/exec/conda-script.py"
)

:: bat file redirect
echo """%PREFIX%\Scripts\activate.bat"" %%*" > %PREFIX%\exec\activate.bat
echo """%PREFIX%\Scripts\conda.exe"" %%*" > %PREFIX%\exec\conda.bat
echo "%PREFIX%\Scripts\activate.bat" %%* > %PREFIX%\exec\activate.bat
echo "%PREFIX%\Scripts\conda.exe" %%* > %PREFIX%\exec\conda.bat

:: TODO: powershell? Not tested. Needs PR https://github.com/conda/conda/issues/626
:: echo "& ""%PREFIX%\Scripts\activate.ps1"" $argumentList" > %PREFIX\exec\activate.ps1
Expand Down
6 changes: 4 additions & 2 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ build:
- bin/conda [unix]
- bin/activate [unix]
- bin/deactivate [unix]
- Scripts/activate [win]
- Scripts/activate.bat [win]
- Scripts/deactivate [win]
- Scripts/deactivate.bat [win]
# TODO: are these needed? They currently break packaging, since these files don't exist yet at build time
# - Scripts/activate [win]
# - Scripts/deactivate [win]
# TODO: what about fish and powershell?

entry_points:
- conda = conda.cli:main
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
'bin/deactivate', ]
if sys.platform == 'win32':
# Powershell scripts should go here
scripts.extend(['bin\\activate.bat',
'bin\\deactivate.bat',])
scripts.extend(['bin/activate.bat',
'bin/deactivate.bat',])

setup(
name=conda.__name__,
Expand Down

0 comments on commit bc9ce3f

Please sign in to comment.