OILS / opy / old / compare.sh View on Github | oilshell.org

76 lines, 44 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# ./compare.sh <function name>
5
6set -o nounset
7set -o pipefail
8set -o errexit
9
10readonly PY27=~/src/Python-2.7.6
11readonly PY36=~/src/Python-3.6.1
12
13readonly DIFF=${DIFF:-diff -u}
14
15ceval() {
16 # 4900 lines vs 5500 lines. Wow
17 wc -l {$PY27,$PY36}/Python/ceval.c
18 return
19 $DIFF {$PY27,$PY36}/Python/ceval.c
20}
21
22ccompile() {
23 # 4000 vs 5300 lines. Big increase. But it depends on the opcodes.
24 wc -l {$PY27,$PY36}/Python/compile.c
25}
26
27opcodes() {
28 #cp -v $PY27/Lib/opcode.py _tmp/opcode27.py
29 #cp -v $PY36/Lib/opcode.py _tmp/opcode36.py
30
31 $DIFF _tmp/opcode{27,36}.py
32 return
33
34 cp $PY27/Lib/dis.py _tmp/dis27.py
35 cp $PY36/Lib/dis.py _tmp/dis36.py
36
37 $DIFF _tmp/dis{27,36}.py
38}
39
402to3-grammar() {
41 # The compiler package was written for a different grammar!
42 $DIFF $PY27/Grammar/Grammar 2to3.grammar
43}
44
45# pgen2 has BACKQUOTE = 25. No main.
46tokens() {
47 $DIFF token.py pgen2/token.py
48}
49
50# This is very different -- is it Python 2 vs. Python 3?
51tokenize() {
52 $DIFF tokenize.py pgen2/tokenize.py
53}
54
55compiler2() {
56 #diff -u $PY27/Lib/compiler/ compiler2
57
58 # The version we're actually running
59 diff -u /usr/lib/python2.7/compiler/ compiler2
60}
61
62compiler26-27() {
63 diff -u ~/src/Python-2.{6,7}.9/Lib/compiler/
64}
65
66compiler27() {
67 diff -u ~/src/Python-2.7.{2,9}/Lib/compiler/
68}
69
70set27() {
71 diff -u ~/src/Python-2.7.{2,3}/Objects/setobject.c
72}
73
74if test $(basename $0) = compare.sh; then
75 "$@"
76fi