Skip to content

Commit

Permalink
Include conda activation in script written from mcgui
Browse files Browse the repository at this point in the history
  • Loading branch information
willend committed May 20, 2024
1 parent c2f576a commit ce0cb34
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/Python/mcgui/mcgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,14 +795,20 @@ def handleJuPyInstrument(self):
wrapper += f'#!/usr/bin/env bash\n\n'
wrapper += f'# cd to location of taget .instr file\n'
wrapper += f'cd ' + os.path.dirname(instr) + '\n\n'
wrapper += f'# call jupylab wrapper script from new directory, with input of base instr file.\n'
if os.environ.get('CONDA_PREFIX'):
wrapper += f'# Activate our "current" conda env.\n'
wrapper += f'. ' + os.environ.get('CONDA_PREFIX') + '/bin/activate \n\n'
wrapper += f'# Call jupylab wrapper script from new directory, with input of base instr file.\n'
wrapper += f'' + scriptfile + ' ' + os.path.basename(instr) + '\n\n'
wrapper += f'# Remove script post jupyter exit \n\nrm -f $0\n\n'
wrapper += f'# End of wrapper script\n'
suffix = ".command"
else:
wrapper += f'@REM cd to location of taget .instr file\n'
wrapper += f'cd ' + os.path.dirname(instr) + '\n\n'
if os.environ.get('CONDA_PREFIX'):
wrapper += f'REM Activate our "current" conda env.\n'
wrapper += f' '+ os.environ.get('CONDA_PREFIX') + '\Scripts\activate \n\n'
wrapper += f'"REM call jupylab wrapper script from new directory, with input of base instr file.\n'
wrapper += f'' + scriptfile + ' ' + os.path.basename(instr) + '\n\n'
wrapper += f'@REM Remove script post jupyter exit \n\n@del %~dpnx0\n@exit\n'
Expand Down

0 comments on commit ce0cb34

Please sign in to comment.