From 5dba007222068110cc591081bfe48ab9bfb7538e Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Thu, 24 Nov 2011 16:56:14 +0100 Subject: [PATCH] Add script to calculate project size. This will help keep the "lightweight" claim up. --- calcsize.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 calcsize.sh diff --git a/calcsize.sh b/calcsize.sh new file mode 100755 index 00000000..c8e44d85 --- /dev/null +++ b/calcsize.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Rougly calculates the size of the (non-whitespace, non-comment) code +# This is a convenience script to make sure our "lightweight" statement on the +# project home page will still hold ;) +# +# Copyright (c) 2011 Vincent Driessen, @nvie +# + +find_source_files() { + find . -name '*.py' | egrep -v '(dummy|examples|setup|tests)' +} + +dump_source_files() { + find_source_files | xargs cat +} + +filter_out_comments_and_whitespace() { + grep -v '^\s*#' | grep -v '^\s*$' | grep -v '"""' +} + +code_size() { + dump_source_files | filter_out_comments_and_whitespace | wc -c +} + +code_locs() { + dump_source_files | filter_out_comments_and_whitespace | wc -l +} + +echo "Size: $(code_size) kB" +echo "Lines: $(code_locs) kB"