head	1.1;
access;
symbols
	rpm-4_4_8-release:1.1
	rpm-4_4_7-release:1.1
	rpm-4_4_6-release:1.1
	rpm-4_4_5-release:1.1
	rpm-4_4_4-release:1.1
	rpm-4_4_3-release:1.1
	jbj_before_tklcpatches:1.1
	rpm-4_4_2-release:1.1
	pjones-sparse-experiment:1.1.0.8
	rpm-4_4_1-release:1.1
	rpm-4_4-release:1.1
	rpm-4_4:1.1.0.6
	rpm-4_3_1-start:1.1
	rpm-4_3:1.1.0.4
	rpm-4_2_1-release:1.1.2.1
	rpm-4_2:1.1.0.2;
locks; strict;
comment	@# @;


1.1
date	2003.06.20.19.04.15;	author jbj;	state Exp;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2003.06.20.19.05.36;	author jbj;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Automagically byte compile python code.
@
text
@#!/bin/sh

# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
	exit 0
fi

# If we don't have a python interpreter, avoid changing anything.
python=${1:-/usr/bin/python}
if [ ! -x "$python" ]; then
	exit 0
fi

# Figure out how deep we need to descend.  We could pick an insanely high
# number and hope it's enough, but somewhere, somebody's sure to run into it.
depth=`(find $RPM_BUILD_ROOT -type f -name "*.py" -print0 ; echo /) | \
       xargs -0 -n 1 dirname | sed 's,[^/],,g' | sort -u | tail -n 1 | wc -c`
if [ -z "$depth" -o "$depth" -le "1" ]; then
	exit 0
fi

# Generate normal (.pyc) byte-compiled files.
$python    -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1)' > /dev/null

# Generate optimized (.pyo) byte-compiled files.
$python -O -c 'import compileall; compileall.compile_dir("'"$RPM_BUILD_ROOT"'", '"$depth"', "/", 1)' > /dev/null
@


1.1.2.1
log
@Automagically byte compile python scripts.
@
text
@@

