File python-wxWidgets-extract-source of Package python-wxWidgets

#!/bin/bash

# Upstream wxPython-src contain complete wxWidgets sources plus several
# legally questionable files.  That is why we repackage it here.

set -x

REMOVE_DIRS=( contrib/samples/applet/monitors.c "wxPython/distrib/msw/*.DLL" "wxPython/distrib/msw/*.dll" )

set -o errexit

CMDNAME=${0##*/}
SOURCEDIR=${0%$CMDNAME}

BASENAME=${1%.tar.bz2}
NEWNAME=${BASENAME/-src/}.tar.bz2

if ! test -f "$1" ; then
    exit 0
fi
if test -f "$NEWNAME" ; then
    if test "$1" -ot "$NEWNAME" ; then
	if test $CMDNAME -ot "$NEWNAME" ; then
	    exit 0
	fi
    fi
fi



cd "$SOURCEDIR"
trap "cd .. ; rm -rf $PWD/tmp$$.python-wxWidgets-extract-source" ERR
rm -rf tmp$$.python-wxWidgets-extract-source
mkdir tmp$$.python-wxWidgets-extract-source
cd tmp$$.python-wxWidgets-extract-source
tar -jxf "../$1"
cd "$BASENAME"

eval rm -rf "${REMOVE_DIRS[@]}"

for ITEM in * ; do
	case "$ITEM" in
	wxPython | docs ) continue ;;
	* ) rm -r "$ITEM"
	esac
done

cd ..
tar -jcf "$NEWNAME" "$BASENAME"

mv  "$NEWNAME" ..
cd ..
rm -r tmp$$.python-wxWidgets-extract-source
openSUSE Build Service is sponsored by