File: hudson.sh

package info (click to toggle)
pymssql 2.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 972 kB
  • sloc: python: 3,801; sh: 152; makefile: 151; ansic: 1
file content (84 lines) | stat: -rwxr-xr-x 2,033 bytes parent folder | download | duplicates (4)
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
cd pymssql

# Check the Python version
case $PYTHON_VERSION in
    27)
        PYTHON=python2.7
        ;;
    31)
        PYTHON=python3.1
        echo "Python 3.1 not supported yet"
        exit 0
        ;;
    *)
        echo "Unknown version of Python"
        exit 1
        ;;
esac

# Check the Platform
if [ $(expr match "$PLATFORM" 'win') -gt 0 ]; then
    if [ "$PLATFORM" = "win32" ]; then
        export WINEPREFIX="$HOME/.wine32"
        export WINEARCH="win32"
    elif [ "$PLATFORM" = "win64" ]; then
        export WINEPREFIX="$HOME/.wine64"
        unset WINEARCH
    else
        echo "Unknown version of Windows"
        exit 1
    fi

    PYDIR="c:\Python$PYTHON_VERSION"

    PYTHON="$PYDIR\python.exe"
    SCRIPTS="$PYDIR\Scripts"

    # Do a clean to start out
    wine $PYTHON setup.py clean

    # Remove possibly left over directories
    rm -rf build dist

    # Build pymssql and create binaries
    wine $PYTHON setup.py build -c mingw32 bdist --formats=egg,wininst

    # Copy the binaries over to the downloads directory
    cp dist/pymssql-*.egg /srv/http/nginx/downloads/pymssql/snapshots/
    cp dist/pymssql-*.exe /srv/http/nginx/downloads/pymssql/snapshots/

elif [ "$PLATFORM" = "linux" ]; then

    # Create the virtual python environment
    PYTHON_ENV=$(mktemp -d)

    if [ "$PYTHON" = "python3.1" ]; then
        VIRTUAL_ENV="python /usr/lib/python3.1/site-packages/virtualenv3.py"
    else
        VIRTUAL_ENV="virtualenv --distribute"
    fi

    $VIRTUAL_ENV --python=$PYTHON $PYTHON_ENV

    # Activate the virtual environment
    source $PYTHON_ENV/bin/activate

    # Install Cython
    easy_install Cython

    # Clean up the workspace
    python setup.py clean
    rm -rf build dist

    # Test building pymssql
    python setup.py build -c unix

    # Create a pymssql egg
    python setup.py bdist_egg

    # Copy the egg over to the downloads directory
    cp dist/pymssql-*.egg /srv/http/nginx/downloads/pymssql/snapshots/

    # Remove the vitualenv
    rm -rf $VIRTUAL_ENV
fi;