From 12fe4f34249fd1c7247547d1e3225381d7b7e93a Mon Sep 17 00:00:00 2001 From: James Meyer Date: Wed, 15 Aug 2012 11:00:13 -0500 Subject: func: fixed for python 2.7 updated msg.py to use msg_daemon --- abs/core/func/PKGBUILD | 19 ++++---- abs/core/func/func_ssl_patch | 12 +++++ abs/core/func/msg.py | 103 ++----------------------------------------- abs/core/func/pacman.py | 2 +- 4 files changed, 28 insertions(+), 108 deletions(-) create mode 100644 abs/core/func/func_ssl_patch diff --git a/abs/core/func/PKGBUILD b/abs/core/func/PKGBUILD index 7e38d5d..08aee30 100644 --- a/abs/core/func/PKGBUILD +++ b/abs/core/func/PKGBUILD @@ -1,6 +1,6 @@ pkgname=func pkgver=0.25 -pkgrel=7 +pkgrel=8 pkgdesc="fedora unifed network controller" url="" license="gpl" @@ -9,15 +9,16 @@ makedepends=() conflicts=() replaces=() backup=('etc/func/minion.conf') -moddir="pkg/usr/lib/python2.6/site-packages/func/minion/modules/" +moddir="pkg/usr/lib/python2.7/site-packages/func/minion/modules/" install=func.install -source=($pkgname-$pkgver.tar.gz minion.conf power.py pacman.py failed_func fe_restart.py msg.py msg.cfg) +source=($pkgname-$pkgver.tar.gz minion.conf power.py pacman.py failed_func fe_restart.py msg.py msg.cfg func_ssl_patch) arch=('i686' 'x86_64') build() { cd $startdir/src/$pkgname-${pkgver} - python setup.py build - python setup.py install --prefix=$startdir/pkg/usr + patch -Np1 < $startdir/src/func_ssl_patch + python2 setup.py build + python2 setup.py install --prefix=$startdir/pkg/usr cd $startdir/src install -m755 -D minion.conf $startdir/pkg/etc/func/minion.conf install -m755 -D $startdir/src/$pkgname-$pkgver/etc/async_methods.conf $startdir/pkg/etc/func/async_methods.conf @@ -32,13 +33,15 @@ build() { mkdir -p $startdir/pkg/var/log/func cd $startdir/pkg + find ./usr/bin/* -exec sed -i 's|#!/usr/bin/python|#!/usr/bin/python2|' {} \; find ./ -name "*.pyc" -print | xargs rm -f } md5sums=('892252004f122c61bb58bb4607553ffe' '1e2905074203d5c0557f143a6c50c497' '1393088fa64823606e0b1c02296041f4' - '21f79d7395edc64b72db5576f9a7f384' + '32cc4d15a3083b518d9f645b656cc273' '5c62fad46fb95a14bc7093b506098e07' 'b02a733b7a74569e57521bc3708724a5' - '572bb6737cb03dee7e9d11ed40481bd2' - '28e141f04ccbdde1199b41888e102dc9') + '1bf9594c41817d4f70d4465b84cbe8b6' + '28e141f04ccbdde1199b41888e102dc9' + 'b816bdb222e646a7801b218c3a626b0e') diff --git a/abs/core/func/func_ssl_patch b/abs/core/func/func_ssl_patch new file mode 100644 index 0000000..cccfe4a --- /dev/null +++ b/abs/core/func/func_ssl_patch @@ -0,0 +1,12 @@ +--- a/func/overlord/sslclient.py ++++ b/func/overlord/sslclient.py +@@ -23,7 +23,11 @@ class SSL_Transport(xmlrpclib.Transport): + # Yay for Python 2.2 + pass + _host, _port = urllib.splitport(host) +- return SSLCommon.HTTPS(_host, int(_port), ssl_context=self.ssl_ctx, timeout=self._timeout) ++ if hasattr(xmlrpclib.Transport, 'single_request'): ++ cnx_class = SSLCommon.HTTPSConnection ++ else: ++ cnx_class = SSLCommon.HTTPS ++ return cnx_class(_host, int(_port), ssl_context=self.ssl_ctx, timeout=self._timeout) diff --git a/abs/core/func/msg.py b/abs/core/func/msg.py index 43214f3..debfe09 100644 --- a/abs/core/func/msg.py +++ b/abs/core/func/msg.py @@ -18,76 +18,6 @@ class msg(func_module.FuncModule): api_version = "0.0.1" description = "Display messages" -#class msg(): - def scroll(self,osd, width, height, display_time,position): - pos = position - step = 1 - - osd.set_position(pos, width, height) - (x, y, _, _) = osd.get_geometry() - osd.set_position_offset(width, height) - osd.show() - - x -= 1 - y += height - 1; - for i in range(1, height + 1, step): - osd.loop_for(5) - y -= step - osd.set_geometry(x, y, width, i) - - osd.set_position(pos, width, height) - osd.set_position_offset(-1, -1) - (x, y, _, _) = osd.get_geometry() - #time to display - osd.loop_for(display_time) - - for i in range(height, 0, -step): - y += step - osd.set_geometry(x, y, width, i); - osd.loop_for(1); - - osd.hide(); - - def setup(self,font_color,font_type): - osd = aosd.AosdText() - osd.set_transparency(aosd.TRANSPARENCY_COMPOSITE) - if osd.get_transparency() != aosd.TRANSPARENCY_COMPOSITE: - osd.set_transparency(aosd.TRANSPARENCY_NONE) - - osd.geom_x_offset = 10 - osd.geom_y_offset = 0 - - osd.back_color = "white" - osd.back_opacity = 50 - - osd.shadow_color = "black" - osd.shadow_opacity = 127 - osd.shadow_x_offset = 2 - osd.shadow_y_offset = 2 - - osd.fore_color = font_color - osd.fore_opacity = 255 - - osd.set_font(font_type) - osd.wrap = aosd.PANGO_WRAP_WORD_CHAR - osd.alignment = aosd.PANGO_ALIGN_LEFT - osd.set_layout_width(osd.get_screen_wrap_width()) - return osd - - def set_string(self, osd, text): - osd.set_text(text) - return osd.get_text_size() - - def setup_config(self): - module_config = ConfigParser.RawConfigParser() - try: - module_config.read('/usr/MythVantage/etc/msg.cfg') - except: - pass - return module_config - - - def display (self,flags): """ parse the msg for display. @@ -99,37 +29,12 @@ class msg(func_module.FuncModule): except: text=flags config_section="default" - - module_config = self.setup_config() - - display_time=5000 - position=6 - font_color="green" - font_type="Times New Roman Italic 36" - try: - display_time = int(module_config.get(config_section,"display_time")) - except: - pass - try: - position = int(module_config.get(config_section,"position")) - except: - pass - try: - font_color = module_config.get(config_section,"font_color") - except: - pass - try: - font_type = module_config.get(config_section,"font_type") - except: - pass - - + text=flags + cmd = sub_process.Popen("/usr/LH/bin/msg_client.py \"%s\" " % text,stdout=sub_process.PIPE,shell=True) + data = cmd.communicate()[0] + cmd = sub_process.Popen("/usr/bin/wall %s" % text,stdout=sub_process.PIPE,shell=True) data = cmd.communicate()[0] - osd = self.setup(font_color, font_type) - width, height = self.set_string(osd, text) - self.scroll(osd, width, height, display_time, position) - return ("Message delivered") diff --git a/abs/core/func/pacman.py b/abs/core/func/pacman.py index ee9f9ea..a01e632 100644 --- a/abs/core/func/pacman.py +++ b/abs/core/func/pacman.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python2 # other modules -- cgit v0.12