From 5fcdfa0c56c0bcaf3d1007eef644e627893f0923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Tue, 11 May 2010 17:54:10 +0200 Subject: Improve constants.py for release script --- portato/constants.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/portato/constants.py b/portato/constants.py index 059017e..5faefe1 100644 --- a/portato/constants.py +++ b/portato/constants.py @@ -26,13 +26,16 @@ These should be set during the installation. @var CONFIG_LOCATION: L{CONFIG_DIR} plus name of the config file. @type CONFIG_LOCATION: string +@var ROOT_DIR: Overall root -- normally just '/'. +@type ROOT_DIR: string +@var DATA_DIR: Directory which contains all shared files. +@type DATA_DIR: string + @var ICON_DIR: directory containing the icons @type ICON_DIR: string @var APP_ICON: the path of the application icon @type APP_ICON: string -@var DATA_DIR: Directory which contains all shared files. -@type DATA_DIR: string @var LOCALE_DIR: the path to the directory where the locale files (*.mo) are stored. @type LOCALE_DIR: string @var PLUGIN_DIR: Directory containing the plugin xmls. @@ -54,8 +57,11 @@ from os.path import join as pjoin if os.getuid() == 0: os.environ["HOME"] = "/root" +ROOT_DIR = "" +DATA_DIR = "./" + # icons -ICON_DIR = "icons/" +ICON_DIR = pjoin(ROOT_DIR, DATA_DIR, "icons/") APP_ICON = pjoin(ICON_DIR, "portato-icon.png") # general @@ -64,14 +70,13 @@ VERSION = "9999" HOME = os.environ["HOME"] # config -CONFIG_DIR = "etc/" +CONFIG_DIR = pjoin(ROOT_DIR, "etc/") CONFIG_LOCATION = pjoin(CONFIG_DIR, "portato.cfg") SESSION_DIR = pjoin(os.environ["HOME"], ".portato") # misc dirs -DATA_DIR = "./" LOCALE_DIR = "i18n/" -PLUGIN_DIR = pjoin(DATA_DIR, "plugins/") +PLUGIN_DIR = pjoin(ROOT_DIR, DATA_DIR, "plugins/") SETTINGS_DIR = pjoin(HOME, "."+APP) TEMPLATE_DIR = "portato/gui/templates/" -- cgit v1.2.3 From e87628fae9c1277e96be51fadb223b4605717437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Tue, 11 May 2010 17:54:33 +0200 Subject: Improve setup.py for release script --- setup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 766b2a2..5334b64 100644 --- a/setup.py +++ b/setup.py @@ -42,17 +42,22 @@ data_files = [ cmdclass = {'build_manpage': build_manpage} # remove useless options / they are the default -for o in ("cython", "eix"): +for o in ( + "eix", + "cython", #!REMOVE + ): try: sys.argv.remove("--enable-"+o) except ValueError: pass # extension stuff -if "--disable-cython" in sys.argv: - sys.argv.remove("--disable-cython") +#!INSERT if not "--enable-cython" in sys.argv: +if "--disable-cython" in sys.argv: #!REMOVE + sys.argv.remove("--disable-cython") #!REMOVE ext = "c" else: + #!INSERT sys.argv.remove("--enable-cython") from Cython.Distutils import build_ext cmdclass['build_ext'] = build_ext ext = "pyx" -- cgit v1.2.3 From cd6bfb92c8cf8bb18a77d84e3592002123f3407e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Tue, 11 May 2010 18:02:37 +0200 Subject: Add a release file --- release.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 release.sh diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..c2c5b62 --- /dev/null +++ b/release.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +fail () +{ + echo ERROR: $1 + exit $2 +} + +replace_by () +{ + echo ">>> ** Replace $1 by $2" + + sed -i -e "s#^\($1\s*=\s*\).*#\1$2#" portato/constants.py \ + || fail "Failure replacing $1" 1 +} + +ver=$(git describe --tags) +name=portato-$ver + +echo ">>> Cloning..." +git clone . $name || fail "Cloning" 1 + +pushd $name > /dev/null + +echo ">>> Compiling Cython sources" +find -name '*.pyx' | xargs cython || fail "Cython" 1 + +echo ">>> Patching constants.py" +replace_by VERSION "'$ver'" +replace_by ROOT_DIR "'/'" +replace_by TEMPLATE_DIR "pjoin(ROOT_DIR, '/usr/share/locale')" +replace_by DATA_DIR "'/usr/share/portato/'" + +echo ">>> Patching setup.py." +sed -i -e "s/^.*#!REMOVE\$//" setup.py || fail "Failure removing lines" 1 +sed -i -e "s/^\(\s*\)#!INSERT \(.*\)/\1\2/" setup.py || fail "Failure inserting lines" 1 + +popd > /dev/null + +echo ">>> Packing" +tar -zcvf ${name}.tar.gz $name --exclude ".git*" || fail "Packing" 1 + +echo ">>> Removing temp dir" +rm -rf $name || fail "Removing" 1 -- cgit v1.2.3 From 3816f2cfdfdb8a4f0dbb90a8c5b554f0b3a7e463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Tue, 11 May 2010 18:41:30 +0200 Subject: Add a README message to the release --- release.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/release.sh b/release.sh index c2c5b62..254a3bb 100755 --- a/release.sh +++ b/release.sh @@ -14,7 +14,7 @@ replace_by () || fail "Failure replacing $1" 1 } -ver=$(git describe --tags) +ver=$(git describe --tags | sed -e "s/^v//") name=portato-$ver echo ">>> Cloning..." @@ -35,6 +35,19 @@ echo ">>> Patching setup.py." sed -i -e "s/^.*#!REMOVE\$//" setup.py || fail "Failure removing lines" 1 sed -i -e "s/^\(\s*\)#!INSERT \(.*\)/\1\2/" setup.py || fail "Failure inserting lines" 1 +echo ">>> Creating README" +cat << EOF > README +This package is intended solely for being used system-wide (normally installed via Portage). + +If you want to have a packed version (for whatever reason), please use one of the following sources: + +* Packed snapshot: http://git.necoro.eu/portato.git/snapshot/portato-v${ver}.tar.gz +* Git Tree: git clone git://necoro.eu/portato.git --> cd portato --> git checkout -b v${ver} v${ver} + +In both cases you should read: http://necoro.eu/portato/development + +EOF + popd > /dev/null echo ">>> Packing" -- cgit v1.2.3 From 7091123e002a911873a9e161173c48694b0a0499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Tue, 11 May 2010 19:10:55 +0200 Subject: Add '--plugin-dir' option --- portato/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/portato/__init__.py b/portato/__init__.py index 61d6a42..12b8fe4 100644 --- a/portato/__init__.py +++ b/portato/__init__.py @@ -17,7 +17,7 @@ import sys, os from optparse import OptionParser, SUPPRESS_HELP from .log import start as logstart -from .constants import LOCALE_DIR, APP, VERSION, REVISION +from .constants import LOCALE_DIR, APP, VERSION, REVISION, PLUGIN_DIR from .helper import debug, info, error # set better version info @@ -53,6 +53,9 @@ def get_parser (use_ = False): parser.add_option("-F", "--no-fork", action = "store_true", dest = "nofork", default = False, help = _("do not fork off as root")) + parser.add_option("--plugin-dir", action = "store_true", dest = "pdir", default = False, + help = _("print the directory the plugins are located in")) + return parser def _sub_start (): @@ -71,6 +74,11 @@ def start(): # run parser (options, args) = get_parser().parse_args() + # plugin dir + if options.pdir: + print PLUGIN_DIR + return + if options.nofork or os.getuid() == 0: # start GUI # close listener at exit -- cgit v1.2.3 From 8c016e8ace989e3e1d0dadd7e54e61849341168f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Tue, 11 May 2010 19:33:22 +0200 Subject: Fix release script pathes --- release.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release.sh b/release.sh index 254a3bb..9a3936f 100755 --- a/release.sh +++ b/release.sh @@ -28,7 +28,8 @@ find -name '*.pyx' | xargs cython || fail "Cython" 1 echo ">>> Patching constants.py" replace_by VERSION "'$ver'" replace_by ROOT_DIR "'/'" -replace_by TEMPLATE_DIR "pjoin(ROOT_DIR, '/usr/share/locale')" +replace_by LOCALE_DIR "pjoin(ROOT_DIR, '/usr/share/locale')" +replace_by TEMPLATE_DIR "pjoin(ROOT_DIR, DATA_DIR, 'templates')" replace_by DATA_DIR "'/usr/share/portato/'" echo ">>> Patching setup.py." -- cgit v1.2.3