diff --git a/deskutils/gdesklets/Makefile b/deskutils/gdesklets/Makefile index b02e3e9ac897..4e095eb6b46d 100644 --- a/deskutils/gdesklets/Makefile +++ b/deskutils/gdesklets/Makefile @@ -6,8 +6,7 @@ # PORTNAME= gdesklets -PORTVERSION= 0.23 -PORTREVISION= 1 +PORTVERSION= 0.24 CATEGORIES= deskutils gnome MASTER_SITES= http://www.pycage.de/download/${PORTNAME}/ DISTNAME= gDesklets-${PORTVERSION} @@ -16,6 +15,7 @@ MAINTAINER= mezz7@cox.net COMMENT= A framework for Gnome 2.x for desktop applets BUILD_DEPENDS= ${PYTHON_SITELIBDIR}/gtk-2.0/gnome/__init__.py:${PORTSDIR}/x11-toolkits/py-gnome2 +LIB_DEPENDS= gtop-2.0.2:${PORTSDIR}/devel/libgtop2 RUN_DEPENDS= ${PYXML} \ ${PYTHON_SITELIBDIR}/gtk-2.0/gnome/__init__.py:${PORTSDIR}/x11-toolkits/py-gnome2 diff --git a/deskutils/gdesklets/distinfo b/deskutils/gdesklets/distinfo index cc9cc8b650bf..fbc4a09d9421 100644 --- a/deskutils/gdesklets/distinfo +++ b/deskutils/gdesklets/distinfo @@ -1 +1 @@ -MD5 (gDesklets-0.23.tar.bz2) = 14beb76893e1f7f8f90b8a0b37a6856a +MD5 (gDesklets-0.24.tar.bz2) = aa4fb8576bd9a98e95f78fbd1fba0ac3 diff --git a/deskutils/gdesklets/files/patch-libdesklets::CPU.py b/deskutils/gdesklets/files/patch-libdesklets::CPU.py index 46f995be5a86..9fb06d253f5c 100644 --- a/deskutils/gdesklets/files/patch-libdesklets::CPU.py +++ b/deskutils/gdesklets/files/patch-libdesklets::CPU.py @@ -1,104 +1,59 @@ # Many thanks to Alexander Leidinger for # help and create those patches. ---- libdesklets/CPU.py.orig Fri Oct 17 22:47:02 2003 -+++ libdesklets/CPU.py Fri Oct 17 22:53:05 2003 -@@ -1,5 +1,7 @@ +--- libdesklets/CPU.py Thu Nov 6 14:50:47 2003 ++++ libdesklets/CPU.py Sun Nov 9 01:34:27 2003 +@@ -1,6 +1,8 @@ import polling + import glibtop +import os +import libdesklets as lib # # TODO: support SMP -@@ -21,8 +23,16 @@ - - self.get_load = polling.wrap(self.__poll_load, 0.2) - -+ platform = lib.sys.get_os() -+ - try: -- fd = open("/proc/cpuinfo", "r") -+ if platform == "FreeBSD": -+ fd = os.popen("grep -3 CPU /var/run/dmesg.boot | head -7 | tail -4", "r") -+ elif platform == "Linux": -+ fd = open("/proc/cpuinfo", "r") -+ else: -+ print "Unknown OS, strange things may happen." -+ return - except IOError, e: - import traceback; traceback.print_exc() - print e -@@ -40,15 +50,24 @@ +@@ -35,20 +37,36 @@ def __poll_cpu(self): - import libdesklets as lib + import re - arch = lib.sys.get_arch() + +- fd = open("/proc/cpuinfo", "r") + platform = lib.sys.get_os() ++ ++ if platform == "FreeBSD": ++ fd = os.popen("grep -3 CPU /var/run/dmesg.boot | head -7 | tail -4", "r") ++ elif platform == "Linux": ++ fd = open("/proc/cpuinfo", "r") ++ else: ++ print "Unknown OS, strange things may happen." ++ return + lines = fd.readlines() + fd.close() + + arch = lib.sys.get_arch() if (arch in ["i386", "i486", "i586", "i686"]): -- fields = self.__lines[4].split() +- fields = lines[4].split() - model_name = " ".join(fields[3:]) -- fields = self.__lines[6].split() +- fields = lines[6].split() - cpu_mhz = fields[3] -- fields = self.__lines[7].split() +- fields = lines[7].split() - cpu_cache = " ".join(fields[3:5]) + if ("FreeBSD" == platform): -+ m = re.search('^CPU: (.*) \(([0-9]+.*)-MHz [0-9]+-class CPU\)', self.__lines[0]) ++ m = re.search('^CPU: (.*) \(([0-9]+.*)-MHz [0-9]+-class CPU\)', lines[0]) + model_name = m.group(1) # or sysctl hw.model + cpu_mhz = m.group(2) # or sysctl hw.clockrate + cpu_cache = " " # not available by default + elif ("Linux" == platform): -+ fields = self.__lines[4].split() ++ fields = lines[4].split() + model_name = " ".join(fields[3:]) -+ fields = self.__lines[6].split() ++ fields = lines[6].split() + cpu_mhz = fields[3] -+ fields = self.__lines[7].split() ++ fields = lines[7].split() + cpu_cache = " ".join(fields[3:5]) + else: + pass elif (arch == "ppc"): - fields = self.__lines[0].split() -@@ -68,17 +87,34 @@ - - def __poll_load(self): - -- fd = open("/proc/stat", "r") -+ platform = lib.sys.get_os() -+ -+ if ("FreeBSD" == platform): -+ fd = os.popen("iostat -n 0", "r") -+ line = 2 -+ elif ("Linux" == platform): -+ fd = open("/proc/stat", "r") -+ line = 0 -+ else: -+ return - data = fd.read() - fd.close() - - data = data.splitlines() -- fields = data[0].split() -+ fields = data[line].split() - -- u = float(fields[1]) -- s = float(fields[2]) -- n = float(fields[3]) -- i = float(fields[4]) -+ if ("FreeBSD" == platform): -+ u = float(fields[2]) + float(fields[3]) -+ s = float(fields[4]) -+ n = float(fields[5]) -+ i = float(fields[6]) -+ elif ("Linux" == platform): -+ u = float(fields[1]) -+ s = float(fields[2]) -+ n = float(fields[3]) -+ i = float(fields[4]) -+ else: -+ pass - - total = ((u - self.__uT) + (s - self.__sT) + (n - self.__nT) + - (i - self.__iT)) + fields = lines[0].split() diff --git a/deskutils/gdesklets/files/patch-libdesklets::Disk.py b/deskutils/gdesklets/files/patch-libdesklets::Disk.py deleted file mode 100644 index 9e626978518b..000000000000 --- a/deskutils/gdesklets/files/patch-libdesklets::Disk.py +++ /dev/null @@ -1,51 +0,0 @@ -# Many thanks to Alexander Leidinger for -# help and create those patches. - ---- libdesklets/Disk.py.orig Mon Sep 22 12:25:18 2003 -+++ libdesklets/Disk.py Mon Sep 22 12:28:28 2003 -@@ -3,7 +3,7 @@ - import time - import os - import statvfs -- -+import libdesklets as lib - - class Disk: - -@@ -19,21 +19,33 @@ - - def __poll_partitions(self): - -+ platform = lib.sys.get_os() -+ - # we don't have to reread the file if it hasn't changed -- if (self.__partitions_last_read >= os.path.getmtime("/etc/mtab")): -+ if (platform == "Linux" and self.__partitions_last_read >= os.path.getmtime("/etc/mtab")): - return self.__partitions - else: - self.__partitions_last_read = time.time() - - # /etc/mtab is more portable than /proc/mount, so we use it -- fd = open("/etc/mtab", "r") -+ if (platform == "Linux"): -+ fd = open("/etc/mtab", "r") -+ else: -+ fd = os.popen("mount", "r") - lines = fd.readlines() - fd.close() - - partitions = [] - for l in lines: - parts = l.split() -- device, mpoint, fstype = parts[:3] -+ if (platform == "Linux"): -+ device, mpoint, fstype = parts[:3] -+ elif (platform == "FreeBSD"): -+ device = parts[0] -+ mpoint = parts[2] -+ import re -+ m = re.search('\(([a-zA-Z]+)[,)]', parts[3]) -+ fstype = m.group(0) - # FIXME: is this OK? it might be better to check if the device - # actually is a file in /dev - if (fstype in ("ext2", "ext3", "msdos", "vfat", "ntfs", "hpfs" diff --git a/deskutils/gdesklets/files/patch-libdesklets::Memory.py b/deskutils/gdesklets/files/patch-libdesklets::Memory.py deleted file mode 100644 index 3d6ebf75c44b..000000000000 --- a/deskutils/gdesklets/files/patch-libdesklets::Memory.py +++ /dev/null @@ -1,124 +0,0 @@ -# Many thanks to Alexander Leidinger for -# help and create those patches. - ---- libdesklets/Memory.py.orig Fri Oct 17 22:57:33 2003 -+++ libdesklets/Memory.py Fri Oct 17 23:01:14 2003 -@@ -1,7 +1,7 @@ - import polling - - import os, stat -- -+import libdesklets as lib - - class Memory: - -@@ -16,41 +16,85 @@ - - def __poll_total_ram(self): - -- memtotal = os.stat("/proc/kcore")[stat.ST_SIZE] -+ platform = lib.sys.get_os() -+ -+ if ("FreeBSD" == platform): -+ fd = os.popen("sysctl hw.physmem") -+ physmem = fd.readline() -+ fd.close() -+ lines = physmem.splitlines() -+ memtotal = int(lines[0].split()[1]) -+ elif ("Linux" == platform): -+ memtotal = os.stat("/proc/kcore")[stat.ST_SIZE] -+ else: -+ memtotal = 0 -+ - return memtotal - - - - def __poll_mem(self, mode): - -- fd = open("/proc/meminfo", "r") -- mem = fd.read() -- fd.close() -- lines = mem.splitlines() -+ platform = lib.sys.get_os() - - # RAM - if (mode == 0): -- total = int(self.__get_total_ram()/1024) -- for l in lines: -- if (l.startswith("MemFree:")): -- value = l.split() -- free = int(value[1]) -- elif (l.startswith("Cached:")): -- value = l.split() -- free = free + int(value[1]) -- break -- used = total - free -+ if ("FreeBSD" == platform): -+ fd = os.popen("vmstat -n 0", "r") -+ elif ("Linux" == platform): -+ fd = open("/proc/meminfo", "r") -+ else: -+ return (0, 0) -+ mem = fd.read() -+ fd.close() -+ lines = mem.splitlines() -+ -+ if ("FreeBSD" == platform): -+ # this may be larger than total, as this is the active virtual -+ # memory, not the active physical memory -+ used = int(lines[2].split()[3])/1024 -+ total = int(self.__get_total_ram()/1024) -+ elif ("Linux" == platform): -+ total = int(self.__get_total_ram()/1024) -+ for l in lines: -+ if (l.startswith("MemFree:")): -+ value = l.split() -+ free = int(value[1]) -+ elif (l.startswith("Cached:")): -+ value = l.split() -+ free = free + int(value[1]) -+ break -+ used = total - free -+ else: -+ pass - - # Swap - elif (mode == 1): -- for l in lines: -- if (l.startswith("SwapTotal:")): -- value = l.split() -- total = int(value[1]) -- elif (l.startswith("SwapFree:")): -- value = l.split() -- free = int(value[1]) -- break -- used = total - free -+ if ("FreeBSD" == platform): -+ fd = os.popen("pstat -T", "r") -+ elif ("Linux" == platform): -+ fd = open("/proc/meminfo", "r") -+ else: -+ return (0, 0) -+ mem = fd.read() -+ fd.close() -+ lines = mem.splitlines() -+ -+ if ("FreeBSD" == platform): -+ used, total = lines[1].split()[0].split("/") -+ used = int(used[0:-2]) * 1024 * 1024 -+ total = int(total[0:-2]) * 1024 * 1024 -+ elif ("Linux" == platform): -+ for l in lines: -+ if (l.startswith("SwapTotal:")): -+ value = l.split() -+ total = int(value[1]) -+ elif (l.startswith("SwapFree:")): -+ value = l.split() -+ free = int(value[1]) -+ break -+ used = total - free -+ else: -+ pass - - return (total, used) diff --git a/deskutils/gdesklets/files/patch-libdesklets::Network.py b/deskutils/gdesklets/files/patch-libdesklets::Network.py index 3629576fdfbb..c14d5146918f 100644 --- a/deskutils/gdesklets/files/patch-libdesklets::Network.py +++ b/deskutils/gdesklets/files/patch-libdesklets::Network.py @@ -1,19 +1,20 @@ # Many thanks to Alexander Leidinger for # help and create those patches. ---- libdesklets/Network.py.orig Fri Oct 17 23:02:41 2003 -+++ libdesklets/Network.py Fri Oct 17 23:24:47 2003 -@@ -1,7 +1,9 @@ +--- libdesklets/Network.py.orig Sun Nov 9 00:52:39 2003 ++++ libdesklets/Network.py Sun Nov 9 00:53:05 2003 +@@ -1,8 +1,8 @@ import polling - - import commands + import glibtop +- +import os import time +- +import libdesklets as lib class Network: -@@ -26,21 +28,42 @@ +@@ -27,21 +27,40 @@ def __poll_devices(self): @@ -34,7 +35,7 @@ - l = lines.strip() - l = l.replace(":", " ") - fields = l.split() - +- - if (fields[0] == "lo"): - continue - else: @@ -57,92 +58,11 @@ + + if (fields[0] == "lo"): + continue -+ else: # (fields[0].startswith("eth")): ++ else: + device = fields[0] + devices.append(device) -+ #end for + else: + pass return devices -@@ -48,14 +71,15 @@ - - def __poll_ipaddr(self, dev): - -- data = commands.getoutput("/sbin/ifconfig " + dev) -- lines = data.splitlines() -- for l in lines: -+ fd = os.popen("/sbin/ifconfig " + dev, "r") -+ data = fd.readlines() -+ fd.close() -+ for l in data: - l = l.strip() - fields = l.split() - - if (fields[0] == "inet"): -- return fields[1].split(":")[1] -+ return fields[1] - - return ("xxx.xxx.xxx.xxx") - -@@ -63,6 +87,8 @@ - - def __poll_in_out(self, dev): - -+ platform = lib.sys.get_os() -+ - t = time.time() - interval = t - self.__time - self.__time = t -@@ -73,24 +99,40 @@ - speed_in = 0 - speed_out = 0 - -- fd = open("/proc/net/dev", "r") -+ if ("FreeBSD" == platform): -+ fd = os.popen("netstat -b -I " + dev + " | grep Link", "r") -+ elif ("Linux" == platform): -+ fd = open("/proc/net/dev", "r") -+ else: -+ return (bytes_in, bytes_out, pack_in, pack_out, speed_in, speed_out) - data = fd.read() - fd.close() - lines = data.splitlines() - - # look for the device - found = 0 -- for l in lines: -- l.strip() -- l = l.replace(":", " ") -- fields = l.split() -- if (fields[0] == dev): -- bytes_in, pack_in, bytes_out, pack_out = \ -- long(fields[1]), long(fields[2]), \ -- long(fields[9]), long(fields[10]) -+ if ("FreeBSD" == platform): -+ for l in lines: - found = 1 -+ fields = l.strip().split() -+ bytes_in, pack_in, bytes_out, pack_out = \ -+ long(fields[6]), long(fields[4]), \ -+ long(fields[9]), long(fields[7]) - break -- #end for -+ elif ("Linux" == platform): -+ for l in lines: -+ l.strip() -+ l = l.replace(":", " ") -+ fields = l.split() -+ if (fields[0] == dev): -+ bytes_in, pack_in, bytes_out, pack_out = \ -+ long(fields[1]), long(fields[2]), \ -+ long(fields[9]), long(fields[10]) -+ found = 1 -+ break -+ #end for -+ else: -+ pass - - # warn if we didn't find the device - if (not found): print ("WARNING:: Device %(dev)s not found!") % vars() diff --git a/deskutils/gdesklets/files/patch-libdesklets::Sys.py b/deskutils/gdesklets/files/patch-libdesklets::Sys.py deleted file mode 100644 index 71ba38f049aa..000000000000 --- a/deskutils/gdesklets/files/patch-libdesklets::Sys.py +++ /dev/null @@ -1,114 +0,0 @@ -# Many thanks to Alexander Leidinger for -# help and create those patches. - ---- libdesklets/Sys.py.orig Mon Sep 22 13:06:41 2003 -+++ libdesklets/Sys.py Mon Sep 22 13:13:11 2003 -@@ -2,7 +2,8 @@ - - import commands - import time -- -+import os -+import libdesklets as lib - - class Sys: - -@@ -31,17 +32,25 @@ - - def __poll_os(self): - -- os = commands.getoutput("uname -o") -- return os -+ platform = commands.getoutput("uname -s") -+ return platform - - - def __poll_uptime(self, mode): - -- fd = open("/proc/uptime", "r") -- data = fd.readlines() -- fd.close() -- -- uptime, idletime = data[0].split() -+ platform = lib.sys.get_os() -+ -+ if ("FreeBSD" == platform): -+ bt = commands.getoutput("sysctl kern.boottime") -+ boottime = int(bt.strip().split()[4].strip(",")) -+ uptime = int(time.time() - float(boottime)) -+ idletime = 0 -+ elif ("Linux" == platform): -+ fd = open("/proc/uptime", "r") -+ data = fd.readlines() -+ fd.close() -+ uptime, idletime = data[0].split() -+ boottime = int(time.time() - float(uptime)) - - # uptime - if (mode == 0): -@@ -51,16 +60,32 @@ - return int(float(idletime)) - # sys start - elif (mode == 2): -- now = time.time() -- return int(now - float(uptime)) -+ return boottime - - - def __poll_load_avg(self, mode): - -- fd = open("/proc/loadavg", "r") -+ import re -+ platform = lib.sys.get_os() -+ -+ if ("FreeBSD" == platform): -+ fd = os.popen("uptime") -+ elif ("Linux" == platform): -+ fd = open("/proc/loadavg", "r") -+ else: -+ return float(0.0) - data = fd.readlines() - fd.close() -- load1, load5, load15, t, d = data[0].split() -+ -+ if ("FreeBSD" == platform): -+ m = re.search('load averages: ([0-9]\.[0-9]+), ([0-9]\.[0-9]+), ([0-9]\.[0-9]+)', data[0]) -+ load1 = m.group(1) -+ load5 = m.group(2) -+ load15 = m.group(3) -+ elif ("Linux" == platform): -+ load1, load5, load15, t, d = data[0].split() -+ else: -+ pass - - # avg over 1 minute - if (mode == 0): -@@ -76,11 +101,25 @@ - - def __poll_tasks(self): - -- fd = open("/proc/loadavg", "r") -+ platform = lib.sys.get_os() -+ -+ if ("FreeBSD" == platform): -+ fd = os.popen("vmstat -n 0") -+ elif ("Linux" == platform): -+ fd = open("/proc/loadavg", "r") -+ else: -+ return (int(0), int(0)) - data = fd.readlines() - fd.close() - -- parts = data[0].split() -- running, tasks = parts[3].split("/") -+ if ("FreeBSD" == platform): -+ parts = data[2].split() -+ running = parts[0] -+ tasks = parts[0] + parts[1] + parts[2] -+ elif ("Linux" == platform): -+ parts = data[0].split() -+ running, tasks = parts[3].split("/") -+ else: -+ pass - - return (int(tasks), int(running)) diff --git a/deskutils/gdesklets/files/patch-libdesklets::__init__.py b/deskutils/gdesklets/files/patch-libdesklets::__init__.py deleted file mode 100644 index 71559b0c184f..000000000000 --- a/deskutils/gdesklets/files/patch-libdesklets::__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# Many thanks to Alexander Leidinger for -# help and create those patches. - ---- libdesklets/__init__.py.orig Fri Oct 17 23:16:45 2003 -+++ libdesklets/__init__.py Fri Oct 17 23:17:09 2003 -@@ -51,11 +51,10 @@ - from Network import Network - from Sys import Sys - -- -+sys = Sys() - convert = Convert() - cpu = CPU() - disk = Disk() - memory = Memory() - net = Network() --sys = Sys() - print "INIT libdesklets (should happen only once)" diff --git a/deskutils/gdesklets/pkg-plist b/deskutils/gdesklets/pkg-plist index 452e0d5a338a..f24e5635c101 100644 --- a/deskutils/gdesklets/pkg-plist +++ b/deskutils/gdesklets/pkg-plist @@ -50,14 +50,19 @@ share/gnome/gdesklets/libdesklets/Memory.py share/gnome/gdesklets/libdesklets/Network.py share/gnome/gdesklets/libdesklets/Sys.py share/gnome/gdesklets/libdesklets/__init__.py +share/gnome/gdesklets/libdesklets/_glibtopmodule.so +share/gnome/gdesklets/libdesklets/glibtop.py share/gnome/gdesklets/libdesklets/polling.py share/gnome/gdesklets/locale/ar/LC_MESSAGES/gdesklets.mo +share/gnome/gdesklets/locale/az/LC_MESSAGES/gdesklets.mo share/gnome/gdesklets/locale/de/LC_MESSAGES/gdesklets.mo +share/gnome/gdesklets/locale/de_BY/LC_MESSAGES/gdesklets.mo share/gnome/gdesklets/locale/el/LC_MESSAGES/gdesklets.mo share/gnome/gdesklets/locale/es/LC_MESSAGES/gdesklets.mo share/gnome/gdesklets/locale/fr/LC_MESSAGES/gdesklets.mo share/gnome/gdesklets/locale/he/LC_MESSAGES/gdesklets.mo share/gnome/gdesklets/locale/ko/LC_MESSAGES/gdesklets.mo +share/gnome/gdesklets/locale/ms/LC_MESSAGES/gdesklets.mo share/gnome/gdesklets/locale/nl/LC_MESSAGES/gdesklets.mo share/gnome/gdesklets/locale/pl/LC_MESSAGES/gdesklets.mo share/gnome/gdesklets/locale/pt/LC_MESSAGES/gdesklets.mo @@ -87,6 +92,7 @@ share/gnome/gdesklets/utils/actionparser.py share/gnome/gdesklets/utils/datatypes.py share/gnome/gdesklets/utils/dialog.py share/gnome/gdesklets/utils/i18n.py +share/gnome/gdesklets/utils/installer.py share/gnome/gdesklets/utils/pwstore.py share/gnome/gdesklets/utils/singleton.py share/gnome/gdesklets/utils/vfs.py @@ -113,6 +119,8 @@ share/icons/gnome/48x48/mimetypes/x-gdesklets-display.png @dirrm share/gnome/gdesklets/locale/pl @dirrm share/gnome/gdesklets/locale/nl/LC_MESSAGES @dirrm share/gnome/gdesklets/locale/nl +@dirrm share/gnome/gdesklets/locale/ms/LC_MESSAGES +@dirrm share/gnome/gdesklets/locale/ms @dirrm share/gnome/gdesklets/locale/ko/LC_MESSAGES @dirrm share/gnome/gdesklets/locale/ko @dirrm share/gnome/gdesklets/locale/he/LC_MESSAGES @@ -123,8 +131,12 @@ share/icons/gnome/48x48/mimetypes/x-gdesklets-display.png @dirrm share/gnome/gdesklets/locale/es @dirrm share/gnome/gdesklets/locale/el/LC_MESSAGES @dirrm share/gnome/gdesklets/locale/el +@dirrm share/gnome/gdesklets/locale/de_BY/LC_MESSAGES +@dirrm share/gnome/gdesklets/locale/de_BY @dirrm share/gnome/gdesklets/locale/de/LC_MESSAGES @dirrm share/gnome/gdesklets/locale/de +@dirrm share/gnome/gdesklets/locale/az/LC_MESSAGES +@dirrm share/gnome/gdesklets/locale/az @dirrm share/gnome/gdesklets/locale/ar/LC_MESSAGES @dirrm share/gnome/gdesklets/locale/ar @dirrm share/gnome/gdesklets/locale