mirror of
https://github.com/oDinZu/callirhoe.git
synced 2025-02-23 00:02:16 -05:00
make_pkg -- minor refactoring git-svn-id: https://callirhoe.googlecode.com/svn/branches/phantome@220 81c8bb96-aa45-f2e2-0eef-c4fa4a15c6df
55 lines
1.3 KiB
Bash
Executable File
55 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
make_python_zip() {
|
|
base="$1"
|
|
tempdir="$2"
|
|
curdir=`pwd`
|
|
for i in `find $tempdir -type f -name "*.py" | grep -v "__init__"`; do
|
|
python2.7 -m py_compile $i
|
|
rm $i
|
|
done
|
|
cd $tempdir
|
|
zip -q -r $curdir/$base.zip *
|
|
cd $curdir
|
|
rm -rf $tempdir
|
|
echo '#!/usr/bin/env python2.7' | cat - $base.zip > $base
|
|
chmod 755 $base
|
|
rm -f $base.zip
|
|
}
|
|
|
|
create_callirhoe_package() {
|
|
DIR=`mktemp -d -t callirhoe.XXX`
|
|
tar c {geom,lang,layouts,lib,style}/*.py | tar x -C "$DIR"
|
|
cp callirhoe.py "$DIR/__main__.py"
|
|
python2.7 scripts/make_resources_list.py > "$DIR/lib/resources.py"
|
|
|
|
make_python_zip callirhoe "$DIR"
|
|
}
|
|
|
|
create_calmagick_package() {
|
|
# Create Calmagick package
|
|
DIR=`mktemp -d -t callirhoe.XXX`
|
|
tar c lib/{__init__,geom}.py | tar x -C "$DIR"
|
|
cp calmagick.py "$DIR/__main__.py"
|
|
|
|
make_python_zip calmagick "$DIR"
|
|
}
|
|
|
|
create_makefile() {
|
|
cat << END > Makefile
|
|
install:
|
|
install -Dm755 callirhoe \$(DESTDIR)/bin/callirhoe
|
|
install -Dm755 calmagick \$(DESTDIR)/bin/calmagick
|
|
END
|
|
|
|
find holidays/* -printf "\tinstall -Dm644 %p \$(DESTDIR)/share/callirhoe/%p\n" >> Makefile
|
|
}
|
|
|
|
set -e
|
|
cd ..
|
|
|
|
create_callirhoe_package
|
|
create_calmagick_package
|
|
|
|
[[ "`uname`" != "Darwin" ]] && create_makefile
|