1 | #!/usr/bin/env bash
|
2 | #
|
3 | # Usage:
|
4 | # ./shedskin.sh <function name>
|
5 |
|
6 | set -o nounset
|
7 | set -o pipefail
|
8 | set -o errexit
|
9 |
|
10 | # Problems
|
11 | # - loading pickle for metadata. It has to dynamically look up classes.
|
12 | # - it won't compile the pickle module due to its use of marshal!
|
13 | # - TODO: we don't need metadata at all?
|
14 |
|
15 | # Fixed
|
16 | # - import posix removed in runtime.py
|
17 | # - _CheckType uses AttributeError: Shed Skin doesn't like it
|
18 |
|
19 | # Unfortunately the ShedSkin compiler crashes after 17 seconds with this error!
|
20 | #
|
21 | # ts = typestrnew(gx, types, cplusplus, node, check_extmod, depth, check_ret, var, tuple_check, mv=mv)
|
22 | # File "/usr/lib/python2.7/dist-packages/shedskin/typestr.py", line 193, in typestrnew
|
23 | # elif not node or infer.inode(gx, node).mv.module.builtin:
|
24 | # AttributeError: 'NoneType' object has no attribute 'module'
|
25 | #
|
26 | # real 0m17.210s
|
27 | # user 0m17.083s
|
28 | # sys 0m0.084s
|
29 |
|
30 |
|
31 | # 0.9.4 was released in 2015. Supposedly fixed in git!
|
32 | #
|
33 | # https://github.com/shedskin/shedskin/issues/203
|
34 |
|
35 | install-latest() {
|
36 | # NOTE: I manually transcribed what I did. Could use virtualenv?
|
37 | pushd ~/git/languages/shedskin
|
38 | python setup.py build
|
39 | sudo python setup.py install
|
40 | }
|
41 |
|
42 | make-tree() {
|
43 | local out=_tmp/shedskin
|
44 | mkdir -p $out
|
45 | #cp -v asdl/{arith_parse.py,tdop.py} _devbuild/gen/demo_asdl.py $out
|
46 |
|
47 | # dependencies of generated code
|
48 | # unpickle probably won't work
|
49 | cp -v asdl/{const.py,runtime.py} $out
|
50 | }
|
51 |
|
52 | run-python() {
|
53 | pushd demo/shedskin
|
54 | ./arith_parse.py '1+2'
|
55 | }
|
56 |
|
57 | # With latest, this generates C++ code, but it doesn't compile.
|
58 | #
|
59 | # TODO: Try something based on tdop.py that is a single module? There are too
|
60 | # many modules here.
|
61 |
|
62 | compile() {
|
63 | pushd demo/shedskin
|
64 | time shedskin arith_parse
|
65 | }
|
66 |
|
67 | count-output() {
|
68 | wc -l demo/shedskin/*.{cpp,hpp} Makefile
|
69 | }
|
70 |
|
71 | "$@"
|