forked from JuroOravec/python-inline-source-2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeps.bat
More file actions
executable file
·47 lines (37 loc) · 2.03 KB
/
deps.bat
File metadata and controls
executable file
·47 lines (37 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
: # This is a bash//cmd hybrid script which runs on both Windows & Linux and installs the dependencies for building chrxer.
: # See https://stackoverflow.com/a/17623721 for details.
: # following line is executed in bash
:; set -e;sudo chmod +x "$(dirname "$0")"/deps.sh;printf "\e[0;31m[Running %s]\033[0m sudo %s\n" "$(date +'%m-%d %T')" "deps.sh $@"; sudo $(dirname "$0")/deps.sh $@; exit 0
@ECHO off
cls
set "pv=3.11.0"
set "ppath=%TEMP%/pyinstaller_%pv%.exe"
set "log=%TEMP%/pyinstaller_%pv%.log"
:: Extract major (first number)
for /f "tokens=1 delims=." %%a in ("%pv%") do set "major=%%a"
:: Extract minor (second number)
for /f "tokens=2 delims=." %%b in ("%pv%") do set "minor=%%b"
for /f "tokens=*" %%i in ('where "python" 2^>nul') do set "pexc0=%%i"
set "pexc1=%LocalAppData%/Programs/Python/Python%major%%minor%/python.exe"
set "pexc2=%LocalAppData%/Programs/Python/Python%major%%minor%-32/python.exe"
if exist "%pexc0%" goto :python_installed
if exist "%pexc1%" goto :python_installed
if exist "%pexc2%" goto :python_installed
echo "Installing Python %pv% .."
set "purl=https://www.python.org/ftp/python/%pv%/python-%pv%-amd64.exe"
curl.exe --output "%ppath%" --url "%purl%"
%ppath% /passive Include_doc=0 Include_pip=1 Include_tcltk=1 Include_test=1 CompileAll=1 Include_symbols=1 Include_debug=1 PrependPath=1 Shortcuts=1 Include_launcher=1
:python_installed
for /f "tokens=*" %%i in ('python -c "import sys; print(sys.executable)" 2^>nul') do set "pexc=%%i"
for %%i in ("%pexc%") do set "pexc_dir=%%~dpi"
2>NUL mklink "%pexc_dir%python%major%%minor%.exe" "%pexc%"
2>NUL mklink "%pexc_dir%python%major%.exe" "%pexc%"
for /f "tokens=*" %%i in ('python%major% -c "import sys; print(sys.executable)"') do set "pexc=%%i"
echo "Python %pv% installed at %pexc%"
if exist "%cd%\.venv" goto :venv_installed
"%pexc%" -m venv "%cd%\.venv"
:venv_installed
echo "installing python packages.."
"%cd%\.venv\Scripts\python.exe" -m pip install --upgrade pip build
"%cd%\.venv\Scripts\python.exe" -m pip install -r requirements.txt -r requirements-dev.txt