OILS / demo / old / ovm.sh View on Github | oilshell.org

40 lines, 18 significant
1#!/usr/bin/env bash
2#
3# Miscellaneous scripts for figuring out OVM.
4#
5# Usage:
6# ./ovm.sh <function name>
7
8set -o nounset
9set -o pipefail
10set -o errexit
11
12source build/common.sh # $PY27
13
14grep-cpython() {
15 find $PY27 -type f | xargs grep "$@"
16}
17
18grep-cpython-c() {
19 find $PY27 -type f -a -name '*.[ch]' | xargs grep "$@"
20}
21
22# https://stackoverflow.com/questions/2224334/gcc-dump-preprocessor-defines
23
24# 493 variables.
25pp-vars() {
26 gcc -E -dM - < $PY27/pyconfig.h
27}
28
29# Modify this function to trace imports. It helped with 're'.
30# Where do codecs.c and codecs.py get imported?
31# codecs.py is from encodings, but I don't know where that gets imported.
32#
33# I think runpy use encodings.
34blame-import() {
35 PYTHONVERBOSE=9 \
36 _OVM_RESOURCE_ROOT=. PYTHONPATH=. \
37 python -S -c 'from bin import oil; import sys; print sys.modules["codecs"]'
38}
39
40"$@"