From f1656ee6787f2459c191f3c42ecb328491c545cd Mon Sep 17 00:00:00 2001 From: Tsuyoshi CHO Date: Thu, 26 Dec 2019 00:00:37 +0900 Subject: Windows native python3(python.exe) and MSYS2 python3 support --- installer/pip_install.cmd | 25 +++++++++++++++++++++++++ settings.json | 6 ++++++ 2 files changed, 31 insertions(+) diff --git a/installer/pip_install.cmd b/installer/pip_install.cmd index 9b8a0b1..c551b7b 100644 --- a/installer/pip_install.cmd +++ b/installer/pip_install.cmd @@ -8,6 +8,30 @@ 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 @@ -16,3 +40,4 @@ echo @echo off ^ %%~dp0\venv\bin\%1.cmd %%* ^ > %1.cmd +goto :EOF diff --git a/settings.json b/settings.json index 992d02d..27d76d6 100644 --- a/settings.json +++ b/settings.json @@ -40,6 +40,12 @@ } ], "python": [ + { + "command": "pyls", + "requires": [ + "py" + ] + }, { "command": "pyls", "requires": [ -- cgit v1.2.3-54-g00ecf From 03a6c769e2413c4cac3aa6bb5d707da934e1bc04 Mon Sep 17 00:00:00 2001 From: Tsuyoshi CHO Date: Sun, 29 Dec 2019 11:34:06 +0900 Subject: python check,pip check,venv verification --- installer/pip_install.cmd | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/installer/pip_install.cmd b/installer/pip_install.cmd index c551b7b..017a478 100644 --- a/installer/pip_install.cmd +++ b/installer/pip_install.cmd @@ -8,6 +8,7 @@ rd /Q /S "%server_dir%" 2>NUL md "%server_dir%" cd "%server_dir%" +REM python(ver 3.x) or python3 check where python && goto :python :python_fail where python3 && goto :python3 @@ -15,29 +16,40 @@ where python3 && goto :python3 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)" if errorlevel 1 goto :python_fail +REM python support slash path split? python -m venv ./venv -venv\Scripts\pip3 install %2 +if not errorlevel 1 goto :install +python -m venv .\venv +goto :install -echo @echo off ^ +: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)" +REM if errorlevel 1 goto :python3_fail -%%~dp0\venv\Scripts\%1.exe %%* ^ +REM python3 support slash path split? +python3 -m venv ./venv +if not errorlevel 1 goto :install +python3 -m venv .\venv +goto :install -> %1.cmd -goto :EOF +:install -: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 +REM 1. pip command path check +where venv\bin\pip3 && set PIPPATH=venv\bin && goto :generate +where venv\Scripts\pip3 && set PIPPATH=venv\Scripts && goto :generate +goto :EOF -python3 -m venv ./venv -venv\bin\pip3 install %2 +REM 2. pyls exec cmd generate +:generate +%PIPPATH%\pip3 install %2 echo @echo off ^ -%%~dp0\venv\bin\%1.cmd %%* ^ +%%~dp0\%PIPPATH%\%1 %%* ^ > %1.cmd -goto :EOF -- cgit v1.2.3-54-g00ecf From 777f83735a55396861f841a2fbdd66a35cc68129 Mon Sep 17 00:00:00 2001 From: Tsuyoshi CHO Date: Sun, 29 Dec 2019 11:53:55 +0900 Subject: fix batch path problem --- installer/pip_install.cmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/installer/pip_install.cmd b/installer/pip_install.cmd index 017a478..dec3f15 100644 --- a/installer/pip_install.cmd +++ b/installer/pip_install.cmd @@ -39,9 +39,9 @@ goto :install :install -REM 1. pip command path check -where venv\bin\pip3 && set PIPPATH=venv\bin && goto :generate -where venv\Scripts\pip3 && set PIPPATH=venv\Scripts && goto :generate +REM 1. pip command path check (env var set just path&&... need) +where venv\bin\:pip3 && set PIPPATH=venv\bin&& goto :generate +where venv\Scripts\:pip3 && set PIPPATH=venv\Scripts&& goto :generate goto :EOF REM 2. pyls exec cmd generate -- cgit v1.2.3-54-g00ecf From 12efb5a18c22d2e179a2b3561c1f52884fdf97dc Mon Sep 17 00:00:00 2001 From: Tsuyoshi CHO Date: Sun, 29 Dec 2019 13:39:15 +0900 Subject: server path fix --- installer/pip_install.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/pip_install.cmd b/installer/pip_install.cmd index dec3f15..ea9f23d 100644 --- a/installer/pip_install.cmd +++ b/installer/pip_install.cmd @@ -3,7 +3,7 @@ if "x%1" equ "x" goto :EOF if "x%2" equ "x" goto :EOF -set server_dir="..\servers\%1" +set server_dir=..\servers\%1 rd /Q /S "%server_dir%" 2>NUL md "%server_dir%" cd "%server_dir%" -- cgit v1.2.3-54-g00ecf From 2f3d1f56face9ca008734c3fc5a4af95dab20fbb Mon Sep 17 00:00:00 2001 From: Tsuyoshi CHO Date: Sun, 29 Dec 2019 14:06:52 +0900 Subject: fix dos format --- installer/pip_install.cmd | 110 +++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/installer/pip_install.cmd b/installer/pip_install.cmd index ea9f23d..c99009f 100644 --- a/installer/pip_install.cmd +++ b/installer/pip_install.cmd @@ -1,55 +1,55 @@ -@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%" - -REM python(ver 3.x) or python3 check -where python && goto :python -:python_fail -where python3 && 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)" -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)" -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 1. pip command path check (env var set just path&&... need) -where venv\bin\:pip3 && set PIPPATH=venv\bin&& goto :generate -where venv\Scripts\:pip3 && set PIPPATH=venv\Scripts&& goto :generate -goto :EOF - -REM 2. pyls exec cmd generate -:generate -%PIPPATH%\pip3 install %2 - -echo @echo off ^ - -%%~dp0\%PIPPATH%\%1 %%* ^ - -> %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%" + +REM python(ver 3.x) or python3 check +where python && goto :python +:python_fail +where python3 && 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)" +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)" +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 && set PIPPATH=venv\bin&& goto :generate +where venv\Scripts\:pip3 && set PIPPATH=venv\Scripts&& goto :generate +goto :EOF + +REM pyls exec cmd generate +:generate +%PIPPATH%\pip3 install %2 + +echo @echo off ^ + +%%~dp0\%PIPPATH%\%1 %%* ^ + +> %1.cmd -- cgit v1.2.3-54-g00ecf From 863ec507b30aebc05ff836e37fae5b8a919bd326 Mon Sep 17 00:00:00 2001 From: Tsuyoshi CHO Date: Sun, 29 Dec 2019 14:53:19 +0900 Subject: pip_install.cmd: folder,error handling fix --- installer/pip_install.cmd | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/installer/pip_install.cmd b/installer/pip_install.cmd index c99009f..73575c1 100644 --- a/installer/pip_install.cmd +++ b/installer/pip_install.cmd @@ -4,20 +4,20 @@ 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 +if exist "%server_dir%" rd /Q /S "%server_dir%" md "%server_dir%" -cd "%server_dir%" +cd /d "%server_dir%" REM python(ver 3.x) or python3 check -where python && goto :python +where python 2>NUL && goto :python :python_fail -where python3 && goto :python3 +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)" +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? @@ -28,7 +28,7 @@ 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)" +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? @@ -40,8 +40,8 @@ goto :install :install REM pip command path check (env var set just path&&... need) -where venv\bin\:pip3 && set PIPPATH=venv\bin&& goto :generate -where venv\Scripts\:pip3 && set PIPPATH=venv\Scripts&& goto :generate +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 -- cgit v1.2.3-54-g00ecf