Skip to content

Instantly share code, notes, and snippets.

@M0r13n
Created November 19, 2019 14:58
Show Gist options
  • Save M0r13n/0bb715d3fd721e2e5a7075dd47dc6dfd to your computer and use it in GitHub Desktop.
Save M0r13n/0bb715d3fd721e2e5a7075dd47dc6dfd to your computer and use it in GitHub Desktop.
Install a Python project offline without any internet connection.
@echo off
:: Basic welcome message
echo Dieses Skript wird die grundlegenden Bestandteile installieren.
echo Nach der Installation sollte sich das Programm ohne Probleme nutzen lassen.
echo.
:: Are you sure prompt
setlocal
:PROMPT
SET /P AREYOUSURE=Möchtest du mit der Installation beginnen (Y/[N])?
IF /I "%AREYOUSURE%" NEQ "Y" GOTO EOF
endlocal
:: Check if Python is installed
>nul 2>nul assoc .py && echo Python ist installiert! || (echo Python scheint nicht installiert zu sein & GOTO ERROR_EXIT)
:: Install virtualenv
if exist %cd%\ext\virtualenv\virtualenv-*.whl (
echo Instllationsdatei feur Virtualenv gefunden. Starte installation.
for /F "usebackq delims=" %%A in (`where /r %cd%\ext\virtualenv *.whl`) do pip install %%A || echo irtualenv konnte nicht installiert werden.
) else (
echo  Die Installationsdatei fuer Virtualenv fehlt.
goto ERROR_EXIT
)
echo Virtualenv erfolgreich installiert!
:: Create a new Virtual environment with offline packages provided by venv
virtualenv --extra-search-dir %cd%\ext\virtualenv\ --no-download venv || goto ERROR_EXIT
echo Virtuelle Umgebung erfolgreich erstellt!
:: Finally install jira and all of it's dependencies offline into the newly created virtual environment
CALL %cd%\venv\Scripts\activate.bat || (Virtuelle Umgebung konnte nicht aktiviert werden!. & goto ERROR_EXIT )
echo Virtuelle Umgebung erfolgreich aktiviert!
pip install --no-index --find-links %cd%\ext\dependencies -r requirements.txt
:NORMAL_EXIT
echo Installation erfolgreich
Pause
goto EOF
:ERROR_EXIT
echo Automate Jira konnte nicht installiert werden.
Pause
goto EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment