From 39aa41fb2d86d7162a2b5ff824135b8ab46d5353 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Tue, 21 Jan 2014 08:24:34 -0800 Subject: [PATCH] Setup functions for CPython development --- zsh/func/setup-cpython | 88 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 zsh/func/setup-cpython diff --git a/zsh/func/setup-cpython b/zsh/func/setup-cpython new file mode 100644 index 0000000..eea5aa6 --- /dev/null +++ b/zsh/func/setup-cpython @@ -0,0 +1,88 @@ +#!/usr/bin/env zsh +# +# Set up for CPython development. +# +# Eryn Wells + + +function _usage-setup-cpython +{ + cat <&2 + return -1 + ;; + esac + done + + if [[ ! -d "$root" ]]; then + print_error "Invalid source root: $root" + return 1 + fi + + export coverage + export lib="$root/Lib" + export root + + function cov + { + local cmd + case "$1" in + (html) + local module="$root/Lib/$2" + if [[ ! -d "$module" ]]; then + if [[ -f "$module.py" ]]; then + module="$module.py" + fi + fi + cmd="html -i --include=$module" + ;; + (report) + cmd="report" + ;; + (run) + cmd="run --pylib --source=$2 Lib/test/regrtest.py test_$2" + ;; + esac + (cd "$root"; ./python.exe "$coverage" "$cmd") + } + + unsetup_functions=(unsetup-cpython) +} + + +function unsetup-cpython +{ + unset coverage + unset lib + unset root + + unfunction cov +} + +setup-cpython "$@"