From c04d190d0173a02b7b052402247add9aacc4ed54 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Sat, 11 Jul 2020 20:24:51 -0300 Subject: [PATCH] Optimized installed scripts. Added a script to create a postinst script that compiles all the sources that doesn't use macros. --- Makefile | 2 ++ debian/make_postinst.pl | 14 ++++++++++++++ debian/postinst | 25 ++++++++++++++----------- 3 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 debian/make_postinst.pl diff --git a/Makefile b/Makefile index 81acb04e..3bce6b13 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,8 @@ USER_ID=$(shell id -u) GROUP_ID=$(shell id -g) deb: + perl debian/make_postinst.pl > debian/postinst + chmod +x debian/postinst fakeroot dpkg-buildpackage -uc -b lint: doc diff --git a/debian/make_postinst.pl b/debian/make_postinst.pl new file mode 100644 index 00000000..ed1da0db --- /dev/null +++ b/debian/make_postinst.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl +@l=glob('kiplot/*.py'); +print("#!/bin/sh\n"); +print("set -e\n"); +foreach $v (@l) + { + $a = `grep "import macros" $v`; + if ($?) + { + $v = "/usr/lib/python3/dist-packages/$v"; + $cmd = "py3compile -V 3.2- $v"; + print("$cmd\n"); + } + } diff --git a/debian/postinst b/debian/postinst index c1d5740c..c347d420 100755 --- a/debian/postinst +++ b/debian/postinst @@ -1,13 +1,16 @@ #!/bin/sh set -e - -# Disabled because macros will fail. -# Automatically added by dh_python3: -#if which py3compile >/dev/null 2>&1; then -# py3compile -p kiplot.inti-cmnb -V 3.2- -#fi -#if which pypy3compile >/dev/null 2>&1; then -# pypy3compile -p kiplot.inti-cmnb -V 3.2- || true -#fi - -# End automatically added section +py3compile -V 3.2- /usr/lib/python3/dist-packages/kiplot/__init__.py +py3compile -V 3.2- /usr/lib/python3/dist-packages/kiplot/__main__.py +py3compile -V 3.2- /usr/lib/python3/dist-packages/kiplot/__version__.py +py3compile -V 3.2- /usr/lib/python3/dist-packages/kiplot/config_reader.py +py3compile -V 3.2- /usr/lib/python3/dist-packages/kiplot/docopt.py +py3compile -V 3.2- /usr/lib/python3/dist-packages/kiplot/error.py +py3compile -V 3.2- /usr/lib/python3/dist-packages/kiplot/gs.py +py3compile -V 3.2- /usr/lib/python3/dist-packages/kiplot/kiplot.py +py3compile -V 3.2- /usr/lib/python3/dist-packages/kiplot/log.py +py3compile -V 3.2- /usr/lib/python3/dist-packages/kiplot/macros.py +py3compile -V 3.2- /usr/lib/python3/dist-packages/kiplot/misc.py +py3compile -V 3.2- /usr/lib/python3/dist-packages/kiplot/optionable.py +py3compile -V 3.2- /usr/lib/python3/dist-packages/kiplot/pre_base.py +py3compile -V 3.2- /usr/lib/python3/dist-packages/kiplot/reg_out.py