changeset 9:d666b9fe5663

dist.sh builds an executable zip file
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sat, 20 Sep 2014 06:44:47 +0200
parents fc866be7843c
children dfefc456dc93
files .hgignore Makefile RemoteViewer/Makefile dist.sh
diffstat 4 files changed, 57 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sat Sep 20 06:44:17 2014 +0200
+++ b/.hgignore	Sat Sep 20 06:44:47 2014 +0200
@@ -2,4 +2,5 @@
 .eric5project
 .pyc
 PyQtLib
-Ui_*
\ No newline at end of file
+RemoteViewer.zip
+Ui_*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Sat Sep 20 06:44:47 2014 +0200
@@ -0,0 +1,12 @@
+.PHONY: remote_viewer pyqt_lib clean
+
+all: remote_viewer pyqt_lib
+	
+remote_viewer:
+	$(MAKE) -C RemoteViewer
+
+pyqt_lib:
+	$(MAKE) -C PyQtLib
+
+clean:
+	rm $(ZIP_FILE) 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RemoteViewer/Makefile	Sat Sep 20 06:44:47 2014 +0200
@@ -0,0 +1,17 @@
+# find all .ui files and generate corresponding filenames ending in .py
+UI_PY_FILES=$(patsubst %.ui, Ui_%.py, $(wildcard *.ui))
+RC_FILES = $(patsubst %.qrc, %_rc.py, $(wildcard *.qrc))
+
+all: $(UI_PY_FILES) $(RC_FILES)
+
+Ui_%.py: %.ui
+	pyuic4 -o $@ $<
+
+%_rc.py: %.qrc
+	pyrcc4 -o $@ $<
+
+.PHONY: clean
+
+clean:
+	rm $(UI_PY_FILES)
+	rm *.pyc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dist.sh	Sat Sep 20 06:44:47 2014 +0200
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+ZIP_FILE="RemoteViewer.zip"
+
+if [ -d $ZIP_FILE ]; then
+	rm $ZIP_FILE
+fi
+
+# make sure all resources are generated before byte-compiling
+make
+
+python -m compileall .
+
+for file in `find . -name \*\.pyc -print`; do
+	echo $file
+	if [[ $file =~ (.*)__pycache__/(.*)\.cpython-..(.*) ]]; then
+		target="${BASH_REMATCH[1]}${BASH_REMATCH[2]}${BASH_REMATCH[3]}"
+		cp $file $target
+		rm $file
+	else
+		echo 'no match'
+		exit 1
+	fi
+done
+
+find . -name \*.pyc -print | xargs zip -@ $ZIP_FILE