File: make.bat

package info (click to toggle)
python-pyftpdlib 1.5.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,132 kB
  • sloc: python: 8,987; makefile: 354
file content (100 lines) | stat: -rw-r--r-- 3,122 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
@echo off

rem ==========================================================================
rem Shortcuts for various tasks, emulating UNIX "make" on Windows.
rem It is primarly intended as a shortcut for installing pyftpdlib and running
rem tests (just run "make.bat test").
rem By default C:\Python27\python.exe is used.
rem To use another Python version run:
rem     set PYTHON=C:\Python24\python.exe & make.bat test
rem ==========================================================================


if "%PYTHON%" == "" (
    set PYTHON=C:\Python27\python.exe
)
if "%TSCRIPT%" == "" (
    set TSCRIPT=pyftpdlib\test\runner.py
)


if "%1" == "help" (
    :help
    echo Run `make ^<target^>` where ^<target^> is one of:
    echo   clean         clean build files
    echo   install       compile and install
    echo   uninstall     uninstall
    echo   test          run tests
    echo   setup-dev-env install all deps
    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)
    for /r %%R in (*.pyd) do if exist %%R (del /s %%R)
    for /r %%R in (*.orig) do if exist %%R (del /s %%R)
    for /r %%R in (*.bak) do if exist %%R (del /s %%R)
    for /r %%R in (*.rej) do if exist %%R (del /s %%R)
    if exist pyftpdlib.egg-info (rmdir /S /Q pyftpdlib.egg-info)
    if exist build (rmdir /S /Q build)
    if exist dist (rmdir /S /Q dist)
    goto :eof
)

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

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

if "%1" == "test" (
    :test
    call :install
    %PYTHON% %TSCRIPT%
    goto :eof
)

if "%1" == "setup-dev-env" (
    :setup-env
    if not exist get-pip.py (
        @echo ------------------------------------------------
        @echo downloading pip installer
        @echo ------------------------------------------------
        C:\python27\python.exe -c "import urllib2; r = urllib2.urlopen('https://bootstrap.pypa.io/get-pip.py'); open('get-pip.py', 'wb').write(r.read())"
    )
    @echo ------------------------------------------------
    @echo installing pip for %PYTHON%
    @echo ------------------------------------------------
    %PYTHON% get-pip.py
    @echo ------------------------------------------------
    @echo upgrade pip for %PYTHON%
    @echo ------------------------------------------------
    %PYTHON% -m pip install pip --upgrade
    @echo ------------------------------------------------
    @echo installing deps
    @echo ------------------------------------------------
    rem mandatory / for unittests
    %PYTHON% -m pip install unittest2 ipaddress mock wmi pypiwin32 pyopenssl --upgrade
    goto :eof
)


goto :help

:error
    echo last command returned an error; exiting
    exit /b %errorlevel%