aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattn <mattn.jp@gmail.com>2019-12-29 14:55:33 +0900
committerGitHub <noreply@github.com>2019-12-29 14:55:33 +0900
commit7ffbcee1eeb3fdf5c40f00fc60015773045c528f (patch)
treedf78ed1827f18bc169ef87154c23d979aae26f67
parent320b2109b2fcd71663c3e997c034b10c057ef5b9 (diff)
parent863ec507b30aebc05ff836e37fae5b8a919bd326 (diff)
downloadvim-lsp-settings-7ffbcee1eeb3fdf5c40f00fc60015773045c528f.tar.gz
vim-lsp-settings-7ffbcee1eeb3fdf5c40f00fc60015773045c528f.tar.bz2
vim-lsp-settings-7ffbcee1eeb3fdf5c40f00fc60015773045c528f.zip
Merge pull request #25 from tsuyoshicho/fix/windows-native-py3
Windows native python3(python.exe) and MSYS2 python3 support
-rw-r--r--installer/pip_install.cmd49
-rw-r--r--settings.json6
2 files changed, 46 insertions, 9 deletions
diff --git a/installer/pip_install.cmd b/installer/pip_install.cmd
index 3fa4b5d..73575c1 100644
--- a/installer/pip_install.cmd
+++ b/installer/pip_install.cmd
@@ -8,17 +8,48 @@ 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
-)
+REM python(ver 3.x) or python3 check
+where python 2>NUL && goto :python
+:python_fail
+where python3 2>NUL && goto :python3
+:python3_fail
+goto :EOF
+
+:python
+REM python is 2 or 3 check(python3 version at python3 grammar)
+python -c "import sys; from distutils.version import LooseVersion;sys.exit(0 if (LooseVersion(sys.version) > LooseVersion('3')) else 1)" 2>NUL
+if errorlevel 1 goto :python_fail
+
+REM python support slash path split?
+python -m venv ./venv
+if not errorlevel 1 goto :install
+python -m venv .\venv
+goto :install
+
+:python3
+REM python3 always python 3.x :-)
+REM python3 -c "import sys; from distutils.version import LooseVersion;sys.exit(0 if (LooseVersion(sys.version) > LooseVersion('3')) else 1)" 2>NUL
+REM if errorlevel 1 goto :python3_fail
+
+REM python3 support slash path split?
+python3 -m venv ./venv
+if not errorlevel 1 goto :install
+python3 -m venv .\venv
+goto :install
+
+:install
+
+REM pip command path check (env var set just path&&... need)
+where venv\bin\:pip3 2>NUL && set PIPPATH=venv\bin&& goto :generate
+where venv\Scripts\:pip3 2>NUL && set PIPPATH=venv\Scripts&& goto :generate
+goto :EOF
+
+REM pyls exec cmd generate
+:generate
+%PIPPATH%\pip3 install %2
echo @echo off ^
-%%~dp0\venv\bin\%1.cmd %%* ^
+%%~dp0\%PIPPATH%\%1 %%* ^
> %1.cmd
diff --git a/settings.json b/settings.json
index 1c01e72..1e4b8a6 100644
--- a/settings.json
+++ b/settings.json
@@ -181,6 +181,12 @@
{
"command": "pyls",
"requires": [
+ "py"
+ ]
+ },
+ {
+ "command": "pyls",
+ "requires": [
"python3"
]
}