diff options
Diffstat (limited to 'make.bat')
-rw-r--r-- | make.bat | 160 |
1 files changed, 64 insertions, 96 deletions
@@ -26,8 +26,16 @@ if "%TSCRIPT%" == "" ( set TSCRIPT=test\test_psutil.py ) -rem Needed to compile using Mingw. -set PATH=C:\MinGW\bin;%PATH% +set PYTHON26=C:\Python26\python.exe +set PYTHON27=C:\Python27\python.exe +set PYTHON33=C:\Python33\python.exe +set PYTHON34=C:\Python34\python.exe +set PYTHON26-64=C:\Python26-64\python.exe +set PYTHON27-64=C:\Python27-64\python.exe +set PYTHON33-64=C:\Python33-64\python.exe +set PYTHON34-64=C:\Python34-64\python.exe + +set ALL_PYTHONS=%PYTHON26% %PYTHON27% %PYTHON33% %PYTHON34% %PYTHON26-64% %PYTHON27-64% %PYTHON33-64% %PYTHON34-64% rem Needed to locate the .pypirc file and upload exes on PYPI. set HOME=%USERPROFILE% @@ -38,10 +46,9 @@ if "%1" == "help" ( :help echo Run `make ^<target^>` where ^<target^> is one of: echo build compile without installing - echo build-exes create exe installers in dist directory - echo build-wheels create wheel installers in dist directory echo build-all build exes + wheels echo clean clean build files + echo flake8 run flake8 echo install compile and install echo setup-env install pip, unittest2, wheels for all python versions echo test run tests @@ -49,8 +56,6 @@ if "%1" == "help" ( echo test-process run process related tests echo test-system run system APIs related tests echo uninstall uninstall - echo upload-exes upload exe installers on pypi - echo upload-wheels upload wheel installers on pypi echo upload-all upload exes + wheels goto :eof ) @@ -70,10 +75,11 @@ if "%1" == "clean" ( if "%1" == "build" ( :build + "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" %PYTHON% setup.py build if %errorlevel% neq 0 goto :error rem copies *.pyd files in ./psutil directory in order to allow - rem "import psutil" when using the interactive interpreter from + rem "import psutil" when using the interactive interpreter from rem within this directory. %PYTHON% setup.py build_ext -i if %errorlevel% neq 0 goto :error @@ -121,113 +127,75 @@ if "%1" == "test-memleaks" ( goto :eof ) -if "%1" == "build-exes" ( - :build-exes - rem "standard" 32 bit versions, using VS 2008 (2.6, 2.7) or VS 2010 (3.3+) - C:\Python26\python.exe setup.py build bdist_wininst || goto :error - C:\Python27\python.exe setup.py build bdist_wininst || goto :error - C:\Python33\python.exe setup.py build bdist_wininst || goto :error - C:\Python34\python.exe setup.py build bdist_wininst || goto :error - rem 64 bit versions - rem Python 2.7 + VS 2008 requires vcvars64.bat to be run first: - rem http://stackoverflow.com/questions/11072521/ - rem Windows SDK and .NET Framework 3.5 SP1 also need to be installed (sigh) - "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" - C:\Python27-64\python.exe setup.py build bdist_wininst || goto :error - C:\Python33-64\python.exe setup.py build bdist_wininst || goto :error - C:\Python34-64\python.exe setup.py build bdist_wininst || goto :error - echo OK - goto :eof -) - -if "%1" == "build-wheels" ( - :build-wheels - C:\Python26\python.exe setup.py build bdist_wheel || goto :error - C:\Python27\python.exe setup.py build bdist_wheel || goto :error - C:\Python33\python.exe setup.py build bdist_wheel || goto :error - C:\Python34\python.exe setup.py build bdist_wheel || goto :error - rem 64 bit versions - rem Python 2.7 + VS 2008 requires vcvars64.bat to be run first: - rem http://stackoverflow.com/questions/11072521/ - rem Windows SDK and .NET Framework 3.5 SP1 also need to be installed (sigh) - "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" - C:\Python27-64\python.exe setup.py build bdist_wheel || goto :error - C:\Python33-64\python.exe setup.py build bdist_wheel || goto :error - C:\Python34-64\python.exe setup.py build bdist_wheel || goto :error - echo OK - goto :eof -) - if "%1" == "build-all" ( - rem for some reason this needs to be called twice (f**king windows...) - call :build-exes - call :build-exes + :build-all + "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" + for %%P in (%ALL_PYTHONS%) do ( + @echo ------------------------------------------------ + @echo building exe for %%P + @echo ------------------------------------------------ + %%P setup.py build bdist_wininst || goto :error + @echo ------------------------------------------------ + @echo building wheel for %%P + @echo ------------------------------------------------ + %%P setup.py build bdist_wheel || goto :error + ) echo OK goto :eof ) -if "%1" == "upload-exes" ( +if "%1" == "upload-all" ( :upload-exes - rem "standard" 32 bit versions, using VS 2008 (2.6, 2.7) or VS 2010 (3.3+) - C:\Python26\python.exe setup.py bdist_wininst upload || goto :error - C:\Python27\python.exe setup.py bdist_wininst upload || goto :error - C:\Python33\python.exe setup.py bdist_wininst upload || goto :error - C:\Python34\python.exe setup.py bdist_wininst upload || goto :error - rem 64 bit versions - C:\Python27-64\python.exe setup.py build bdist_wininst upload || goto :error - C:\Python33-64\python.exe setup.py build bdist_wininst upload || goto :error - C:\Python34-64\python.exe setup.py build bdist_wininst upload || goto :error - echo OK - goto :eof -) - -if "%1" == "upload-wheels" ( - :build-wheels - C:\Python26\python.exe setup.py build bdist_wheel upload || goto :error - C:\Python27\python.exe setup.py build bdist_wheel upload || goto :error - C:\Python33\python.exe setup.py build bdist_wheel upload || goto :error - C:\Python34\python.exe setup.py build bdist_wheel upload || goto :error - rem 64 bit versions - rem Python 2.7 + VS 2008 requires vcvars64.bat to be run first: - rem http://stackoverflow.com/questions/11072521/ - rem Windows SDK and .NET Framework 3.5 SP1 also need to be installed (sigh) "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" - C:\Python27-64\python.exe setup.py build bdist_wheel upload || goto :error - C:\Python33-64\python.exe setup.py build bdist_wheel upload || goto :error - C:\Python34-64\python.exe setup.py build bdist_wheel upload || goto :error + for %%P in (%ALL_PYTHONS%) do ( + @echo ------------------------------------------------ + @echo uploading exe for %%P + @echo ------------------------------------------------ + %%P setup.py build bdist_wininst upload || goto :error + @echo ------------------------------------------------ + @echo uploading wheel for %%P + @echo ------------------------------------------------ + %%P setup.py build bdist_wheel upload || goto :error + ) echo OK goto :eof ) -if "%1" == "upload-all" ( - call :upload-exes - call :upload-wheels - echo OK +if "%1" == "setup-env" ( + :setup-env + @echo ------------------------------------------------ + @echo downloading pip installer + @echo ------------------------------------------------ + C:\python27\python.exe -c "import urllib2; r = urllib2.urlopen('https://raw.github.com/pypa/pip/master/contrib/get-pip.py'); open('get-pip.py', 'wb').write(r.read())" + for %%P in (%ALL_PYTHONS%) do ( + @echo ------------------------------------------------ + @echo installing pip for %%P + @echo ------------------------------------------------ + %%P get-pip.py + ) + for %%P in (%ALL_PYTHONS%) do ( + @echo ------------------------------------------------ + @echo installing deps for %%P + @echo ------------------------------------------------ + rem mandatory / for unittests + %%P -m pip install unittest2 ipaddress mock wmi wheel --upgrade + rem nice to have + %%P -m pip install ipdb pep8 pyflakes flake8 --upgrade + ) goto :eof ) -if "%1" == "setup-env" ( - echo downloading pip installer - C:\python27\python.exe -c "import urllib2; url = urllib2.urlopen('https://raw.github.com/pypa/pip/master/contrib/get-pip.py'); data = url.read(); f = open('get-pip.py', 'w'); f.write(data)" - C:\python26\python.exe get-pip.py & C:\python26\scripts\pip install unittest2 wheel ipaddress --upgrade - C:\python27\python.exe get-pip.py & C:\python27\scripts\pip install wheel ipaddress --upgrade - C:\python33\python.exe get-pip.py & C:\python33\scripts\pip install wheel ipaddress --upgrade - C:\python34\scripts\easy_install.exe wheel - rem 64-bit versions - C:\python27-64\python.exe get-pip.py & C:\python27-64\scripts\pip install wheel ipaddress --upgrade - C:\python33-64\python.exe get-pip.py & C:\python33-64\scripts\pip install wheel ipaddress --upgrade - C:\python34-64\scripts\easy_install.exe wheel - rem install ipdb only for py 2.7 and 3.4 - C:\python27\scripts\pip install ipdb --upgrade - C:\python34\scripts\easy_install.exe ipdb +if "%1" == "flake8" ( + :flake8 + %PYTHON% -c "from flake8.main import main; main()" goto :eof ) goto :help :error - echo ------------------------------------------------ - echo last command exited with error code %errorlevel% - echo ------------------------------------------------ - exit /b %errorlevel% + @echo ------------------------------------------------ + @echo last command exited with error code %errorlevel% + @echo ------------------------------------------------ + @exit /b %errorlevel% goto :eof |