View | Details | Raw Unified | Return to bug 168373
Collapse All | Expand All

(-)./Makefile (-2 / +2 lines)
Lines 6-12 Link Here
6
#
6
#
7
7
8
PORTNAME=	pydf
8
PORTNAME=	pydf
9
PORTVERSION=	9
9
PORTVERSION=	10
10
CATEGORIES=	sysutils
10
CATEGORIES=	sysutils
11
MASTER_SITES=	http://kassiopeia.juls.savba.sk/~garabik/software/pydf/
11
MASTER_SITES=	http://kassiopeia.juls.savba.sk/~garabik/software/pydf/
12
DISTNAME=	${PORTNAME}_${PORTVERSION}
12
DISTNAME=	${PORTNAME}_${PORTVERSION}
Lines 16-23 Link Here
16
16
17
LICENSE=	unknown
17
LICENSE=	unknown
18
LICENSE_NAME=	Public Domain
18
LICENSE_NAME=	Public Domain
19
LICENSE_PERMS=	${_LICENSE_PERMS_DEFAULT}
20
LICENSE_FILE=	${WRKSRC}/COPYING
19
LICENSE_FILE=	${WRKSRC}/COPYING
20
LICENSE_PERMS=	${_LICENSE_PERMS_DEFAULT}
21
21
22
SUB_FILES=	pkg-message
22
SUB_FILES=	pkg-message
23
23
(-)./distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (pydf_9.tar.gz) = 57f0c10449b1e3c37618f145f96b150768e15fb22af9c72f628f66a3632012c0
1
SHA256 (pydf_10.tar.gz) = 71be682c86a352afbafcf612cbc236f6f5810d80635685869a9c9b320203e241
2
SIZE (pydf_9.tar.gz) = 12942
2
SIZE (pydf_10.tar.gz) = 13430
(-)./files/patch-pydf (-117 lines)
Lines 1-117 Link Here
1
--- pydf.old	2010-10-05 23:50:06.000000000 +0200
2
+++ pydf	2010-10-06 00:28:36.000000000 +0200
3
@@ -1,6 +1,6 @@
4
-#! /usr/bin/python
5
+#! %%PYTHON_CMD%%
6
 
7
-import sys, os, string, subprocess, struct
8
+import sys, os, string, struct
9
 from optparse import OptionParser
10
 
11
 from math import log
12
@@ -10,6 +10,14 @@
13
     # will not give the same result for broken symbolic links, but who cares...
14
     os.path.lexists = os.path.exists
15
 
16
+if sys.version_info < (3, 0):
17
+    # getoutput() and getstatusoutput() methods have
18
+    # been moved from commands to the subprocess module
19
+    # with Python >= 3.x
20
+    import commands as cmd
21
+else:
22
+    import subprocess as cmd
23
+
24
 str_ljust = str.ljust
25
 str_rjust = str.rjust
26
 str_center = str.center
27
@@ -61,7 +69,7 @@
28
     
29
 
30
 def get_terminal_width_resize():
31
-    c = subprocess.getoutput('resize').split('\n')
32
+    c = cmd.getoutput('resize').split('\n')
33
     c = [x for x in c if x.startswith('COLUMNS=')]
34
     if c:
35
         c = c[0]
36
@@ -167,7 +175,7 @@
37
 #end of default definitions
38
 
39
 # read configuration file
40
-for conffile in ["/etc/pydfrc", os.environ['HOME']+"/.pydfrc"]:
41
+for conffile in ["%%PREFIX%/etc/pydfrc", os.environ['HOME']+"/.pydfrc"]:
42
     if os.path.isfile(conffile):
43
         exec(compile(open(conffile).read(), conffile, 'exec'))
44
 
45
@@ -290,7 +298,7 @@
46
                 break
47
         else:
48
             # fallback, first try to parse mount output
49
-            status, mout = subprocess.getstatusoutput('mount')
50
+            status, mout = cmd.getstatusoutput('mount')
51
             if status !=0:
52
                 return dummy_result
53
             mlines = mout.split('\n')
54
@@ -300,11 +308,16 @@
55
                     continue
56
                 device, on = line.split(' on ', 1)
57
                 device = device.split()[0]
58
-                onparts = on.split()
59
+                onparts = on.rstrip(")").split(" (")
60
                 on = onparts[0]
61
-                # option format: (a,b,..)
62
-                opts = onparts[-1][1:-1].split(',')
63
-                r[on] = (device, '', opts)
64
+                l = onparts[1].split(", ")
65
+                if len(l) == 2:
66
+                    typ, opts = l
67
+                else:
68
+                    typ = l[0]
69
+                    opts = ''
70
+                opts = opts.split(", ")
71
+                r[on] = (device, typ, opts)
72
 
73
             if r:
74
                 return r
75
@@ -334,7 +347,11 @@
76
 def get_row_mp(mp):
77
     if mp:
78
         if mp in mountpoints:
79
-            device, fstype, opts = mountpoints[mp]
80
+            if len(mountpoints[mp]) == 2:
81
+                device, fstype = mountpoints[mp]
82
+                opts = ''
83
+            else:
84
+                device, fstype, opts = mountpoints[mp]
85
         else:
86
             # oops, the mountpoint is not in /etc/mtab or equivalent
87
             # return dummy values
88
@@ -346,9 +363,9 @@
89
             status = os.statvfs(mp)
90
         except (OSError, IOError):
91
             status = DumbStatus()
92
-        fs_blocksize = status.f_bsize
93
+        fs_blocksize = status.f_frsize
94
         if fs_blocksize == 0:
95
-            fs_blocksize = status.f_frsize
96
+            fs_blocksize = status.f_bsize
97
         free = status.f_bfree
98
         size = status.f_blocks
99
         avail = status.f_bavail
100
@@ -377,7 +394,7 @@
101
             used_f = myformat(used, sizeformat, fs_blocksize)
102
             avail_f = myformat(avail, sizeformat, fs_blocksize)
103
             try:
104
-                perc = round(100.*used/size, 1)
105
+                perc = round(100.*used/(avail+used), 1)
106
                 perc_f = str(perc)
107
             except ZeroDivisionError:
108
                 perc = 0
109
@@ -446,7 +463,7 @@
110
     "test if fs (as type) is a special one"
111
     "in addition, a filesystem is special if it has number of blocks equal to 0"
112
     fs = fs.lower()
113
-    return fs in [ "tmpfs", "devpts", "proc", "sysfs", "usbfs" ]
114
+    return fs in [ "tmpfs", "devpts", "proc", "sysfs", "usbfs", "procfs", "devfs", "linprocfs", "fdescfs" ]
115
 
116
 def get_table(mps):
117
     "table is a list of rows"

Return to bug 168373