summaryrefslogtreecommitdiff
path: root/update_stdlib.sh
blob: 0cdbb1bd4a7bb203e8ac76155210ff3360922755 (plain)
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
#!/bin/bash

# Script to copy asyncio files to the standard library tree.
# Optional argument is the root of the Python 3.4 tree.
# Assumes you have already created Lib/asyncio and
# Lib/test/test_asyncio in the destination tree.

CPYTHON=${1-$HOME/cpython}

if [ ! -d $CPYTHON ]
then
    echo Bad destination $CPYTHON
    exit 1
fi

if [ ! -f asyncio/__init__.py ]
then
    echo Bad current directory
    exit 1
fi

maybe_copy()
{
    SRC=$1
    DST=$CPYTHON/$2
    if cmp $DST $SRC
    then
        return
    fi
    echo ======== $SRC === $DST ========
    diff -u $DST $SRC
    echo -n "Copy $SRC? [y/N/back] "
    read X
    case $X in
        [yY]*) echo Copying $SRC; cp $SRC $DST;;
	back) echo Copying TO $SRC; cp $DST $SRC;;
        *) echo Not copying $SRC;;
    esac
}

for i in `(cd asyncio && ls *.py)`
do
    if [ $i == test_support.py ]
    then
        continue
    fi

    if [ $i == selectors.py ]
    then
        if [ "`(cd $CPYTHON; hg branch)`" == "3.4" ]
        then
            echo "Destination is 3.4 branch -- ignoring selectors.py"
        else
            maybe_copy asyncio/$i Lib/$i
        fi
    else
        maybe_copy asyncio/$i Lib/asyncio/$i
    fi
done

for i in `(cd tests && ls *.py *.pem)`
do
    if [ $i == test_selectors.py ]
    then
        continue
    fi
    maybe_copy tests/$i Lib/test/test_asyncio/$i
done

maybe_copy overlapped.c Modules/overlapped.c