<commit_before>@ECHO OFF

REM ===========================================================================
REM Shortcuts for various tasks, emulating UNIX "make".
REM Use this to script for various tasks such as runing tests, install
REM psutil, etc.
REM To run tests run "make.bat test".
REM This script is modeled after my Windows installation so it might
REM need some adjustements in order to work on your system.
REM The following assumptions are made:
REM - Python is installed in C:\PythonXY\python.exe
REM - the right Visual Studio version is installed
REM - in case of Python 2.4 and 2.5 use mingw32 compiler
REM ===========================================================================


SET PYTHON=C:\Python27\python.exe
SET PATH=%PYTHON%;%PATH%
SET PATH=C:\MinGW\bin;%PATH%


if "%1" == "" goto help

if "%1" == "help" (
    :help
    echo Please use `make ^<target^>` where ^<target^> is one of:
    echo clean build install uninstall test
    goto :EOF
)

if "%1" == "clean" (
    call :clean
    goto :EOF
)

if "%1" == "build" (
    call :build
    goto :EOF
)

if "%1" == "install" (
    call :install
    goto :EOF
)

if "%1" == "uninstall" (
    rmdir /S /Q %PYTHON%\Lib\site-packages\psutil
    del /F /S /Q %PYTHON%\Lib\site-packages\psutil*
    del /F /S /Q %PYTHON%\Lib\site-packages\_psutil*
    goto :EOF
)

if "%1" == "test" (
    call :install
    %PYTHON% test/test_psutil.py
    goto :EOF
)

if "%1" == "create-exes" (
    call :clean
    C:\Python26\python.exe setup.py build bdist_wininst
    C:\Python27\python.exe setup.py build bdist_wininst
    C:\Python33\python.exe setup.py build bdist_wininst
    goto :EOF
)


goto :help

:install
    call :build
    %PYTHON% setup.py install
    goto :EOF

:build
    if %PYTHON%==C:\Python24\python.exe (
        %PYTHON% setup.py build -c mingw32
    ) else if %PYTHON%==C:\Python25\python.exe (
        %PYTHON% setup.py build -c mingw32
    ) else (
        %PYTHON% setup.py build
    )
    goto :EOF

:clean
    for /F "tokens=*" %%G IN ('dir /B /AD /S __pycache__') DO rmdir /S /Q %%G
    for /r %%R in (*.pyc) do if exist %%R (del /s %%R)
    if exist build (rmdir /S /Q build)
    if exist dist (rmdir /S /Q dist)
    goto :EOF<commit_msg>build.bat refactoring<commit_after>@ECHO OFF

REM ===========================================================================
REM Shortcuts for various tasks, emulating UNIX "make".
REM Use this to script for various tasks such as runing tests, install
REM psutil, etc.
REM To run tests run "make.bat test".
REM This script is modeled after my Windows installation so it might
REM need some adjustements in order to work on your system.
REM The following assumptions are made:
REM - Python is installed in C:\PythonXY\python.exe
REM - the right Visual Studio version is installed
REM - in case of Python 2.4 and 2.5 use mingw32 compiler
REM ===========================================================================


SET PYTHON=C:\Python27\python.exe
SET PATH=%PYTHON%;%PATH%
SET PATH=C:\MinGW\bin;%PATH%



if "%1" == "help" (
    :help
    echo Run `make ^<target^>` where ^<target^> is one of:
    echo   clean         clean build files
    echo   build         compile without installing
    echo   install       compile and install
    echo   uninstall     uninstall
    echo   test          run tests
    echo   create-exes   create exe installers in dist directory
    goto :eof
)

if "%1" == "clean" (
    :clean
    for /r %%R in (__pycache__) do if exist %%R (rmdir /S /Q %%R)
    for /r %%R in (*.pyc) do if exist %%R (del /s %%R)
    if exist build (rmdir /S /Q build)
    if exist dist (rmdir /S /Q dist)
    goto :eof
)

if "%1" == "build" (
    :build
    if %PYTHON%==C:\Python24\python.exe (
        %PYTHON% setup.py build -c mingw32
    ) else if %PYTHON%==C:\Python25\python.exe (
        %PYTHON% setup.py build -c mingw32
    ) else (
        %PYTHON% setup.py build
    )
    goto :eof
)

if "%1" == "install" (
    install:
    call :build
    %PYTHON% setup.py install
    goto :eo
)

if "%1" == "uninstall" (
    uninstall:
    rmdir /S /Q %PYTHON%\Lib\site-packages\psutil
    del /F /S /Q %PYTHON%\Lib\site-packages\psutil*
    del /F /S /Q %PYTHON%\Lib\site-packages\_psutil*
    goto :eof
)

if "%1" == "test" (
    test:
    call :install
    %PYTHON% test/test_psutil.py
    goto :eof
)

if "%1" == "create-exes" (
    create-exes:
    call :clean
    C:\Python26\python.exe setup.py build bdist_wininst
    C:\Python27\python.exe setup.py build bdist_wininst
    C:\Python33\python.exe setup.py build bdist_wininst
    goto :eof
)

goto :help

:eof
{'fraction_non_alphanumeric': 0.17994356414152377, 'fraction_numerical': 0.012806598654221837, 'mean_word_length': 2.875525651808242, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3325076', 'n_tokens_mistral': 1685, 'n_tokens_neox': 1546, 'n_words': 539}