Commit 3e5034d9827505ef5f8edd993f1469fb31f2d144
1 parent
45ad0ad6
added install.bat
Showing
1 changed file
with
103 additions
and
0 deletions
install.bat
0 → 100644
| 1 | +@echo off | |
| 2 | +rem INSTALL.BAT - Easy installer for Python modules on Windows | |
| 3 | + | |
| 4 | +rem version 0.04 2014-02-24 Philippe Lagadec - http://www.decalage.info | |
| 5 | + | |
| 6 | +rem License: | |
| 7 | +rem This file install.bat can freely used, modified and redistributed, as | |
| 8 | +rem long as credit to the author is kept intact. Please send any feedback, | |
| 9 | +rem issues or improvements to decalage at laposte.net. | |
| 10 | + | |
| 11 | +rem CHANGELOG: | |
| 12 | +rem 2007-09-04 v0.01 PL: - first version, for Python 2.3 to 2.5 | |
| 13 | +rem 2009-02-27 v0.02 PL: - added support for Python 2.6 | |
| 14 | +rem 2013-05-07 v0.03 PL: - added support for Python 2.7 | |
| 15 | +rem 2014-02-24 v0.04 PL: - added support for py.exe | |
| 16 | + | |
| 17 | +rem 1) test if py.exe or python.exe is in the path: | |
| 18 | +rem (py.exe is better because it can select python 2 or 3 according to shebang lines) | |
| 19 | + | |
| 20 | +py.exe --version >NUL 2>&1 | |
| 21 | +if errorlevel 1 goto notpy | |
| 22 | +echo py.exe found in the path. | |
| 23 | +py.exe setup.py install | |
| 24 | +if errorlevel 1 goto error | |
| 25 | +goto end | |
| 26 | +:NOTPY | |
| 27 | + | |
| 28 | +python.exe --version >NUL 2>&1 | |
| 29 | +if errorlevel 1 goto notpath | |
| 30 | +echo Python.exe found in the path. | |
| 31 | +python setup.py install | |
| 32 | +if errorlevel 1 goto error | |
| 33 | +goto end | |
| 34 | +:NOTPATH | |
| 35 | + | |
| 36 | +rem 2) test for usual python.exe paths: | |
| 37 | + | |
| 38 | +REM Python 2.7: | |
| 39 | +c:\python27\python.exe --version >NUL 2>&1 | |
| 40 | +if errorlevel 1 goto notpy27 | |
| 41 | +echo Python.exe found in C:\Python27 | |
| 42 | +c:\python27\python.exe setup.py install | |
| 43 | +if errorlevel 1 goto error | |
| 44 | +goto end | |
| 45 | +:NOTPY27 | |
| 46 | + | |
| 47 | +REM Python 2.6: | |
| 48 | +c:\python26\python.exe --version >NUL 2>&1 | |
| 49 | +if errorlevel 1 goto notpy26 | |
| 50 | +echo Python.exe found in C:\Python26 | |
| 51 | +c:\python26\python.exe setup.py install | |
| 52 | +if errorlevel 1 goto error | |
| 53 | +goto end | |
| 54 | +:NOTPY26 | |
| 55 | + | |
| 56 | +c:\python25\python.exe --version >NUL 2>&1 | |
| 57 | +if errorlevel 1 goto notpy25 | |
| 58 | +echo Python.exe found in C:\Python25 | |
| 59 | +c:\python25\python.exe setup.py install | |
| 60 | +if errorlevel 1 goto error | |
| 61 | +goto end | |
| 62 | +:NOTPY25 | |
| 63 | + | |
| 64 | +c:\python24\python.exe --version >NUL 2>&1 | |
| 65 | +if errorlevel 1 goto notpy24 | |
| 66 | +echo Python.exe found in C:\Python24 | |
| 67 | +c:\python24\python.exe setup.py install | |
| 68 | +if errorlevel 1 goto error | |
| 69 | +goto end | |
| 70 | +:NOTPY24 | |
| 71 | + | |
| 72 | +c:\python23\python.exe --version >NUL 2>&1 | |
| 73 | +if errorlevel 1 goto notpy23 | |
| 74 | +echo Python.exe found in C:\Python23 | |
| 75 | +c:\python23\python.exe setup.py install | |
| 76 | +if errorlevel 1 goto error | |
| 77 | +goto end | |
| 78 | +:NOTPY23 | |
| 79 | + | |
| 80 | +"c:\program files\python\python.exe" --version >NUL 2>&1 | |
| 81 | +if errorlevel 1 goto notpf | |
| 82 | +echo Python.exe found in C:\Program Files\Python | |
| 83 | +"c:\program files\python\python.exe" setup.py install | |
| 84 | +if errorlevel 1 goto error | |
| 85 | +goto end | |
| 86 | +:NOTPF | |
| 87 | + | |
| 88 | +rem 3) last we just try to launch the script, if .py is associated to python.exe | |
| 89 | +echo Python.exe not found, trying to launch setup.py directly. | |
| 90 | +setup.py install | |
| 91 | +if errorlevel 1 goto error | |
| 92 | +goto end | |
| 93 | + | |
| 94 | +:ERROR | |
| 95 | +echo. | |
| 96 | +echo If the installation is not successful, try to run "python setup.py install" | |
| 97 | +echo or simply "setup.py install" in the script directory. | |
| 98 | +echo You can also copy files by hand in the site-package directory of your | |
| 99 | +echo Python directory. | |
| 100 | +REM pause | |
| 101 | + | |
| 102 | +:END | |
| 103 | +pause | ... | ... |