aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--installer/pip_install.cmd67
-rw-r--r--settings.json6
2 files changed, 49 insertions, 24 deletions
diff --git a/installer/pip_install.cmd b/installer/pip_install.cmd
index 3fa4b5d..c551b7b 100644
--- a/installer/pip_install.cmd
+++ b/installer/pip_install.cmd
@@ -1,24 +1,43 @@
-@echo off
-
-if "x%1" equ "x" goto :EOF
-if "x%2" equ "x" goto :EOF
-
-set server_dir=..\servers\%1
-if exist "%server_dir%" rd /Q /S "%server_dir%"
-md "%server_dir%"
-cd /d "%server_dir%"
-
-where python3 2>NUL
-if %ERRORLEVEL% neq 0 (
- python3 -m venv ./venv
- venv\bin\pip3 install %2
-) else (
- python -m venv ./venv
- venv\bin\pip install %2
-)
-
-echo @echo off ^
-
-%%~dp0\venv\bin\%1.cmd %%* ^
-
-> %1.cmd
+@echo off
+
+if "x%1" equ "x" goto :EOF
+if "x%2" equ "x" goto :EOF
+
+set server_dir="..\servers\%1"
+rd /Q /S "%server_dir%" 2>NUL
+md "%server_dir%"
+cd "%server_dir%"
+
+where python && goto :python
+:python_fail
+where python3 && goto :python3
+:python3_fail
+goto :EOF
+
+:python
+python -c "import sys; from distutils.version import LooseVersion;sys.exit(0 if (LooseVersion(sys.version) > LooseVersion('3')) else 1)"
+if errorlevel 1 goto :python_fail
+
+python -m venv ./venv
+venv\Scripts\pip3 install %2
+
+echo @echo off ^
+
+%%~dp0\venv\Scripts\%1.exe %%* ^
+
+> %1.cmd
+goto :EOF
+
+:python3
+python3 -c "import sys; from distutils.version import LooseVersion;sys.exit(0 if (LooseVersion(sys.version) > LooseVersion('3')) else 1)"
+if errorlevel 1 goto :python3_fail
+
+python3 -m venv ./venv
+venv\bin\pip3 install %2
+
+echo @echo off ^
+
+%%~dp0\venv\bin\%1.cmd %%* ^
+
+> %1.cmd
+goto :EOF
diff --git a/settings.json b/settings.json
index 0265c0d..bf6c978 100644
--- a/settings.json
+++ b/settings.json
@@ -147,6 +147,12 @@
{
"command": "pyls",
"requires": [
+ "py"
+ ]
+ },
+ {
+ "command": "pyls",
+ "requires": [
"python3"
]
}