pydf-10/0000755000000000000000000000000011671137257007136 5ustar pydf-10/pydf0000755000000000000000000004663111671137035010032 0ustar #! /usr/bin/python import sys, os, re, string, struct from optparse import OptionParser from math import log if not 'lexists' in dir(os.path): # for python < 2.4 # will not give the same result for broken symbolic links, but who cares... os.path.lexists = os.path.exists if sys.version_info[0] < 3: # getoutput() and getstatusoutput() methods have # been moved from commands to the subprocess module # with Python >= 3.x import commands as cmd else: import subprocess as cmd str_ljust = str.ljust str_rjust = str.rjust str_center = str.center # again an ugly hack for python < 2.4 try: str_ljust('dummy', 1, '.') except TypeError: str_ljust = lambda x, y, z: string.ljust (x, y).replace(' ', z) str_rjust = lambda x, y, z: string.rjust (x, y).replace(' ', z) str_center = lambda x, y, z: string.center (x, y).replace(' ', z) class Bar: def __init__(self, percentage=0, width=2, header=False): self.percentage = percentage self.width = width self.header = header def __len__(self): return self.width def __str__(self): return self.format(self, 'l') def format(self, pos): if self.header: return ' '*self.width size = int(round(self.percentage*(self.width-2))) return '['+manglestring(size*barchar, self.width-2, pos, bar_fillchar)+']' def get_terminal_width_termios(): try: import fcntl, termios except ImportError: return None s = struct.pack("HHHH", 0, 0, 0, 0) try: lines, cols, xpixels, ypixels = \ struct.unpack( "HHHH", fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, s) ) except (IOError, AttributeError): return None return cols def get_terminal_width_resize(): c = cmd.getoutput('resize').split('\n') c = [x for x in c if x.startswith('COLUMNS=')] if c: c = c[0] dummy, c = c.split('=', 1) if c[-1] == ';': c = c[:-1] if c: return int(c) else: return None def get_terminal_width_dumb(): return 80 def get_terminal_width(): handlers = [get_terminal_width_termios, get_terminal_width_resize, get_terminal_width_dumb] for handler in handlers: width = handler() if width: return width return 80 # fallback, should not happen def find_mountpoint(path): if not os.path.lexists(path): sys.stderr.write('pydf: %s: No such file or directory\n' % repr(path)) return None while not os.path.ismount(path): path = os.path.dirname(path) return path #some default definitions colours = { 'none' : "", 'default' : "\033[0m", 'bold' : "\033[1m", 'underline' : "\033[4m", 'blink' : "\033[5m", 'reverse' : "\033[7m", 'concealed' : "\033[8m", 'black' : "\033[30m", 'red' : "\033[31m", 'green' : "\033[32m", 'yellow' : "\033[33m", 'blue' : "\033[34m", 'magenta' : "\033[35m", 'cyan' : "\033[36m", 'white' : "\033[37m", 'on_black' : "\033[40m", 'on_red' : "\033[41m", 'on_green' : "\033[42m", 'on_yellow' : "\033[43m", 'on_blue' : "\033[44m", 'on_magenta' : "\033[45m", 'on_cyan' : "\033[46m", 'on_white' : "\033[47m", 'beep' : "\007" } normal_colour = 'default' header_colour = 'yellow' local_fs_colour = 'default' remote_fs_colour = 'green' special_fs_colour = 'blue' readonly_fs_colour = 'cyan' filled_fs_colour = 'red' full_fs_colour = 'on_red' sizeformat = "-h" column_separator = ' ' column_separator_colour = 'none' row_separator = '' hidebinds = True stretch_screen = 0.3 do_total_sum = False FILL_THRESH = 95.0 FULL_THRESH = 99.0 format = [ ('fs', 10, "l"), ('size', 5, "r"), ('used', 5, "r"), ('avail', 5, "r"), ('perc', 4, "r"), ('bar', 0.1, "l"), ('on', 11, "l") ] barchar = '#' bar_fillchar = '.' mountfile = ['/etc/mtab', '/etc/mnttab', '/proc/mounts'] #end of default definitions # read configuration file for conffile in ["/etc/pydfrc", os.environ['HOME']+"/.pydfrc"]: if os.path.isfile(conffile): exec(compile(open(conffile).read(), conffile, 'exec')) header = { 'fs' : "Filesystem", 'size' : "Size", 'used' : "Used", 'avail' : "Avail", 'on' : "Mounted on", 'fstype' : "Type", 'perc' : "Use%", 'bar' : Bar(header=True), } def out(s): try: sys.stdout.write(s) except UnicodeEncodeError: sys.stdout.write(s.encode('ascii', 'replace').decode()) class DumbStatus: "emulates statvfs results with only zero values" f_bsize = f_frsize = f_blocks = f_bfree = f_bavail = f_files = f_ffree = f_favail = f_flag = f_namemax =0 def hfnum(size, base): "human readable number" if size == 0: return "0" if size < 0: return "?" if inodes: units = [""] else: units = ["B"] units += ["k", "M", "G", "T", "P", "Z", "Y"] power = int(log(size)/log(base)) if power < 0: power = 0 if power >= len(units): power = len(units)-1 nsize = int(round(1.*size/(base**power))) if nsize < 10 and power >= 1: power -= 1 nsize = int(round(1.*size/(base**power))) r = str(nsize) + units[power] return r def myformat(number, sizeformat, fs_blocksize): "format number as file size. fs_blocksize here is a filesysem blocksize" size = int(number)*fs_blocksize if blocksize: # that is, blocksize was explicitly set up sn = round(1.*size/blocksize) sn = int(sn) return str(sn) if sizeformat == "-k": sn = round(size/1024.) sn = int(sn) return str(sn) elif sizeformat == "-m": sn = round(size/(1024.*1024)) sn = int(sn) return str(sn) elif sizeformat == "-g": sn = round(size/(1024.*1024*1024)) sn = int(sn) return str(sn) elif sizeformat == "-h": return hfnum(size, 1024) elif sizeformat == "-H": return hfnum(size, 1000) elif sizeformat == "--blocks": return str(number) else: # this should not happen raise ValueError("Impossible error, contact the author, sizeformat="+repr(sizeformat)) def manglestring(s, l, pos, fillchar=' '): "cut string to fit exactly into l chars" if pos == "r": ns = str_rjust(s, l, fillchar) elif pos == "l": ns = str_ljust(s, l, fillchar) elif pos == "c": ns = str_center(s, l, fillchar) else: raise ValueError('Error in manglestring') if len(ns) > l: ns = ns[:int(l/2)] + "~" + ns[-int(l/2)+1:] return ns def makecolour(clist): "take list (or tuple or just one name) of colour names and return string of ANSI definitions" s = "" if type(clist) == str: lclist = [clist] else: lclist = clist for i in lclist: s = s + colours[i] return s def version(): return '10' def get_all_mountpoints(): "return all mountpoints in fs" # fallback when nothing else works dummy_result = {'/': ('/', '')} if isinstance(mountfile, str): f = open(mountfile,"rb") else: for i in mountfile: if os.path.exists(i): f = open(i,"rb") break else: # fallback, first try to parse mount output status, mout = cmd.getstatusoutput('mount') if status !=0: return dummy_result mlines = mout.split('\n') r = {} for line in mlines: if not ' on ' in line: continue device, on = line.split(' on ', 1) device = device.split()[0] onparts = on.split() on = onparts[0] # option format: (a,b,..) opts = onparts[-1][1:-1].split(',') r[on] = (device, '', opts) if r: return r else: return dummy_result mountlines = f.readlines() # bytes in python3 # convert to representable strings (for python3) # unfortunately, we cannot keep it as bytes, because of a known bug # in python3 forcing us to use string, not bytes as filename for os.statvfs if sys.version_info[0]>=3: mountlines = [x.decode(sys.stdin.encoding, 'replace') for x in mountlines] r = {} for l in mountlines: spl = l.split() if len(spl)<4: print("Error in", mountfile) print(repr(l)) continue device, mp, typ, opts = spl[0:4] opts = opts.split(',') r[mp] = (device, typ, opts) return r def niceprint_fs(fs): "print LVM as nice symlink" matchObj = re.search( r'^\/dev\/mapper\/(.*)-(.*)', fs) if matchObj: return "/dev/" + matchObj.group(1) + "/" + matchObj.group(2) else: return fs def get_row_mp(mp): if mp: if mp in mountpoints: device, fstype, opts = mountpoints[mp] device = niceprint_fs(device) else: # oops, the mountpoint is not in /etc/mtab or equivalent # return dummy values device, fstype, opts = '-', '-', '-' rdonly = 'ro' in opts or fstype in ("iso9660", "udf") bind = 'bind' in opts or 'rbind' in opts try: status = os.statvfs(mp) except (OSError, IOError): status = DumbStatus() fs_blocksize = status.f_bsize if fs_blocksize == 0: fs_blocksize = status.f_frsize free = status.f_bfree size = status.f_blocks avail = status.f_bavail inodes_free = status.f_ffree inodes_size = status.f_files inodes_avail = status.f_favail if (size==0 or is_special_fs(fstype)) and not allfss: return if bind and hidebinds: return used = size-free inodes_used = inodes_size - inodes_free if inodes: size_f = myformat(inodes_size, sizeformat, 1) used_f = myformat(inodes_used, sizeformat, 1) avail_f = myformat(inodes_avail, sizeformat, 1) try: perc = round(100.*inodes_used/inodes_size, 1) perc_f = str(perc) except ZeroDivisionError: perc = 0 perc_f = '-' else: size_f = myformat(size, sizeformat, fs_blocksize) used_f = myformat(used, sizeformat, fs_blocksize) avail_f = myformat(avail, sizeformat, fs_blocksize) try: perc = round(100.*used/size, 1) perc_f = str(perc) except ZeroDivisionError: perc = 0 perc_f = '-' info = { 'fs' : device, 'size' : size_f, 'used' : used_f, 'avail' : avail_f, 'on' : mp, 'fstype' : fstype, 'perc' : perc_f, 'bar' : None, } current_colour = local_fs_colour if is_remote_fs(fstype): current_colour = remote_fs_colour elif size == 0 or is_special_fs(fstype): current_colour = special_fs_colour else: # header current_colour = header_colour row = [] for j in format: if j[0]=='bar': width = j[1] if 0 FULL_THRESH: current_colour = full_fs_colour elif perc > FILL_THRESH: current_colour = filled_fs_colour if j[0]=='bar': info['bar'] = Bar(perc/100., width) text = info[j[0]] else: text = header[j[0]] if j[0]=='bar': text.width = width column = [current_colour, text] row.append(column) return row def is_remote_fs(fs): "test if fs (as type) is a remote one" fs = fs.lower() return fs in [ "nfs", "smbfs", "cifs", "ncpfs", "afs", "coda", "ftpfs", "mfs", "sshfs", "fuse.sshfs" ] def is_special_fs(fs): "test if fs (as type) is a special one" "in addition, a filesystem is special if it has number of blocks equal to 0" fs = fs.lower() return fs in [ "tmpfs", "devpts", "devtmpfs", "proc", "sysfs", "usbfs" ] def get_table(mps): "table is a list of rows" "row is a list of columns" "column is a list of [colour code, content]" "content is a string, unless it is a Bar() instance" rows = [get_row_mp(None)] for mp in mps: row = get_row_mp(mp) if row is not None: rows.append(row) return rows def squeeze_table(table, desired_width): "squeeze table to fit into width characters" cols = len(table[0]) # build a row of minimal (possible, from format) cell sizes minrow = [] for j in format: width = j[1] if 0 < width < 1: # i.e. percentage width = int(width*terminal_width)-1 minrow.append(width) # row of maximal cell sizes maxrow = [0]*cols for row in table: for col in range(cols): colsize = len(row[col][1]) maxrow[col] = max(maxrow[col], colsize) # maximal differences between (real cell size - minimal possible cell size) deltarow = [maxrow[i]-minrow[i] for i in range(cols)] deltas = list(zip(deltarow, list(range(cols)))) deltas.sort() deltas.reverse() # how many characters we need to cut off from table width to_reduce = sum(maxrow) + (cols-1)*len(column_separator) - desired_width to_stretch = 0 # if there is free space if to_reduce < 0 and stretch_screen: # -to_reduce is now number of spare characters to_stretch = int(-to_reduce * stretch_screen) new_maxrow = maxrow[:] # new sizes for delta, i in deltas: if to_reduce < 0: # we have finished break if delta >= to_reduce: new_maxrow[i] -= to_reduce # and we finished to_reduce = 0 break else: new_maxrow[i] -= delta # now it contains the minimal possible width to_reduce -= delta if to_reduce > 0: # we were not able to reduce the size enough # since it will wrap anywway, we might as well display # complete long lines new_maxrow = maxrow for row in table: for col in range(cols): cell_content = row[col][1] if isinstance(cell_content, Bar): cell_content.width += to_stretch formatted_cell_content = cell_content.format(format[col][2]) else: formatted_cell_content = manglestring(cell_content, new_maxrow[col], format[col][2]) row[col][1] = formatted_cell_content def display_table(table, terminal_width): "display our internal output table" squeeze_table(table, terminal_width-1) colsepcol = makecolour(column_separator_colour) for row in table: firstcol = True for colourcode, text in row: if firstcol: firstcol = False else: out(colsepcol) out(column_separator) out(makecolour(colourcode)) out(text) out(row_separator) out(makecolour(normal_colour)) out('\n') # the fun begins here parser = OptionParser(usage="usage: %prog [options] arg", add_help_option=False) parser.version = '%prog version ' + version() parser.add_option("", "--help", action="help", help="show this help message") parser.add_option("-v", "--version", action="version", help="show version") parser.add_option("-a", "--all", action="store_true", dest="show_all", default=False, help="include filesystems having 0 blocks") parser.add_option("-h", "--human-readable", action="store_const", const='-h', dest="sizeformat", help="print sizes in human readable format (e.g., 1K 234M 2G)") parser.add_option("-H", "--si", action="store_const", const='-H', dest="sizeformat", help="likewise, but use powers of 1000 not 1024") parser.add_option("-b", "--block-size", action="store", dest="blocksize", default=0, type="int", help="use BLOCKSIZE-byte blocks") parser.add_option("-l", "--local", action="store_true", dest="local_only", default=False, help="limit listing to local filesystems") parser.add_option("-k", "--kilobytes", action="store_const", const='-k', dest="sizeformat", help="like --block-size=1024") parser.add_option("-m", "--megabytes", action="store_const", const='-m', dest="sizeformat", help="like --block-size=1048576") parser.add_option("-g", "--gigabytes", action="store_const", const='-g', dest="sizeformat", help="like --block-size=1073741824") parser.add_option("", "--blocks", action="store_const", const='--blocks', dest="sizeformat", help="use filesystem native block size") parser.add_option("", "--bw", action="store_true", dest="b_w", default=False, help="do not use colours") #parser.add_option("", "--sum", # action="store_true", dest="do_total_sum", default=False, # help="display sum of all the displayed sizes") parser.add_option("", "--mounts", action="store", dest="mounts_file", type="string", help="""File to get mount information from. On normal Linux systems only /etc/mtab or /proc/mounts make sense. Some other Unices use /etc/mnttab. Use /proc/mounts when /etc/mtab is corrupted or inaccessible (the output looks a bit weird in this case).""") parser.add_option("-B", "--show-binds", action="store_false", dest="hidebinds", default=hidebinds, help="show 'mount --bind' mounts") parser.add_option("-i", "--inodes", action="store_true", dest="inodes", default=False, help="show inode instead of block usage") (options, args) = parser.parse_args() blocksize = options.blocksize allfss = options.show_all localonly = options.local_only hidebinds = options.hidebinds inodes = options.inodes if inodes: header["size"] = "Nodes" if options.sizeformat: sizeformat = options.sizeformat #if options.do_total_sum: # do_total_sum = True if options.b_w: normal_colour = header_colour = local_fs_colour = remote_fs_colour = special_fs_colour = filled_fs_colour = full_fs_colour = 'none' if options.mounts_file: mountfile = options.mounts_file terminal_width = get_terminal_width() mountpoints = get_all_mountpoints() if args: mp_to_display = [find_mountpoint(os.path.realpath(x)) for x in args] mp_to_display = [x for x in mp_to_display if x is not None] else: mp_to_display = list(mountpoints.keys()) if localonly: mp_to_display = [x for x in mp_to_display if not is_remote_fs(mountpoints[x][1])] mp_to_display.sort() table = get_table(mp_to_display) display_table(table, terminal_width) pydf-10/attic/0000755000000000000000000000000010621544642010234 5ustar pydf-10/attic/gs.py0000755000000000000000000000134310621544642011223 0ustar #!/usr/bin/python # get terminal size # from resize(1) # it does not work quite properly and there is a simpler way # # do not use import os, time, termios from termios import ICRNL, IUCLC, ICANON, ECHO, CS8, VMIN, VTIME, TCSANOW, TCSADRAIN, TCSAFLUSH getsize = "\0337\033[r\033[999;999H\0336n\033[18t" restoreemu = "\0338" ttyfd = os.open('/dev/tty', os.O_RDWR) tioorig = termios.tcgetattr(ttyfd) tio = tioorig[:] tio[0] &= ~(ICRNL | IUCLC) # iflag tio[3] &= ~(ICANON | ECHO) # lflag tio[2] |= CS8 # cflag tio[6][VMIN] = 6 # cc tio[6][VTIME] = 1 # cc termios.tcsetattr(ttyfd, TCSAFLUSH, tio) os.write(ttyfd, getsize) x = os.read(ttyfd, len(getsize)) os.write(ttyfd, restoreemu) termios.tcsetattr(ttyfd, TCSADRAIN, tioorig) print `x` pydf-10/README0000644000000000000000000000371011167637426010022 0ustar pydf is all-singing, all-dancing, fully colourised df(1)-clone written in python. Requirements: pydf was written for linux, using specific linux features. The fact it runs on other systems is pure coincidence, but neverthless it happens to work on wide range of modern unix systems. System-wide configuration is in /etc/pydfrc, per-user configuration in ~/.pydfrc (format of these files is the same) Colours are one of: none, default, bold, underline, blink, reverse, concealed, black, green, yellow, blue, magenta, cyan, white, on_black, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white beep on_red means that the background (instead of foreground) is painted with red etc... pydf recognizes following parameters: --help show this help message -a, --all include filesystems having 0 blocks -h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G) -H, --si likewise, but use powers of 1000 not 1024 -bBLOCKSIZE, --block-size=BLOCKSIZE use SIZE-byte blocks -l, --local limit listing to local filesystems -k, --kilobytes like --block-size=1024 -m, --megabytes like --block-size=1048576 -g, --gigabytes like --block-size=1073741824 --blocks use filesystem native block size --bw do not use colours --mounts=MOUNTS_FILE File to get mount information from. On normal linux system, only /etc/mtab or proc/mounts make sense. Some other unices use /etc/mnttab. Use /proc/mounts when /etc/mtab is corrupted or inaccesable (the output looks a bit weird in this case). -B, --show-binds show also mount --bind mounted filesystems Written by Radovan Garabík . For new versions, look at http://kassiopeia.juls.savba.sk/~garabik/software/pydf/ pydf-10/debian/0000755000000000000000000000000011671137257010360 5ustar pydf-10/debian/dirs0000644000000000000000000000001310004000407011205 0ustar usr/bin etcpydf-10/debian/docs0000644000000000000000000000000710004000407011177 0ustar README pydf-10/debian/menu0000644000000000000000000000012610004000407011215 0ustar ?package(pydf):needs=text section=Apps/System\ title="pydf" command="/usr/bin/pydf" pydf-10/debian/control0000644000000000000000000000057211671136540011761 0ustar Source: pydf Section: utils Priority: optional Maintainer: Radovan Garabík Standards-Version: 3.8.3 Build-Depends: debhelper (>= 4.0.0), python (>= 2.2) Package: pydf Architecture: all Depends: python (>= 2.2) Suggests: Description: colourised df(1)-clone pydf is all-singing, all-dancing, fully colourised df(1)-clone written in Python. pydf-10/debian/rules0000755000000000000000000000311511356404021011422 0ustar #!/usr/bin/make -f #-*- makefile -*- # Made with the aid of dh_make, by Craig Small # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. # Some lines taken from debmake, by Christoph Lameter. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 build: build-stamp build-stamp: dh_testdir # Add here commands to compile the package. # $(MAKE) touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp install-stamp # Add here commands to clean up after the build process. # -$(MAKE) clean dh_clean install: install-stamp install-stamp: build-stamp dh_testdir dh_testroot dh_clean -k dh_installdirs cp -f pydf `pwd`/debian/pydf/usr/bin cp -f pydfrc `pwd`/debian/pydf/etc touch install-stamp # Build architecture-dependent files here. #binary-arch: build install # We have nothing to do by default. # Build architecture-independent files here. binary-indep: build install # dh_testversion dh_testdir dh_testroot dh_installdocs dh_installexamples # dh_installmenu # dh_installemacsen # dh_installinit # dh_installcron dh_installman pydf.1 # dh_undocumented dh_installchangelogs # dh_link dh_strip dh_compress dh_fixperms # You may want to make some executables suid here # dh_suidregister # dh_makeshlibs dh_installdeb # dh_perl # dh_python dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb source diff: @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary pydf-10/debian/changelog0000644000000000000000000002152311671134400012220 0ustar pydf (10) unstable; urgency=low * normal_colour was not interpreting colour codes properly (thanks to Juhapekka Tolvanen and Norman Rasmussen for pointing this out) (closes: #577595, #582462) * if termios reports zero for terminal width, use fallback (closes: #577454) * added devtmpfs to the list of special filesystems (closes: #577453), both bugreports thanks to Romain Francoise * use subprocess or commands depending on major python version (closes: #579936), patch thanks to Emmanuel Bouthenot * remove parentheses in class definition, to enable python2.4 compatibility (thanks to Clint Savage) * add patch for /dev/mapper links, thanks to Ernest Beinrohr -- Radovan Garabík Sun, 11 Dec 2011 15:06:41 +0200 pydf (9) unstable; urgency=low * remove stray ANSI escape sequence when using --bw mode * convert to run with python3 (thanks to Dror Levin) -- Radovan Garabík Mon, 29 Mar 2010 23:06:15 +0200 pydf (8) unstable; urgency=low * run pylint & pychecker -- fix some previously unnoticed bugs * treat "special" filesystems and those with 0 blocks the same (i.e. do not display them unless -a option is given) * add fuse.sshfs to the list of networked filesystems -- Radovan Garabík Sat, 24 Oct 2009 17:40:14 +0200 pydf (7) unstable; urgency=low * add 'inodes' option (closes: #51044), patch thanks to Thomas Rösner * change 'blocks-size' option into 'block-size', as originally intended * if the used percentage is meaningless, display '-' instead of 0 * minor documentation updates -- Radovan Garabík Fri, 10 Apr 2009 14:40:00 +0200 pydf (6) unstable; urgency=low * add the 'hidebinds' options (thanks to Martin von Wittich) -- Radovan Garabík Thu, 17 Apr 2008 22:24:03 +0200 pydf (5) unstable; urgency=low * make the bar stretchable, to fill the whole screen width -- Radovan Garabík Fri, 10 Aug 2007 13:53:49 +0200 pydf (4) unstable; urgency=low * fix scrolling artefacts at the bottom of terminal * fix accidentally removed possibility to use colour sequences -- Radovan Garabík Thu, 19 Jul 2007 14:54:15 +0200 pydf (3) unstable; urgency=low * completely rewrited formatting code, now utilizes better screen width (closes: #421118) * display special filesystems with block_size != 0 in different colour -- Radovan Garabík Sun, 15 Jul 2007 19:36:05 +0200 pydf (2) unstable; urgency=low * use termios to get terminal size, does not need resize(1) anymore (thanks to Josip Rodin for the idea) -- Radovan Garabík Sun, 13 May 2007 10:14:45 +0200 pydf (1) unstable; urgency=low * show read only mounted filesystems in different colour (thanks to Michał J. Gajda and Bastian Kleineidam) * add binary-arch target to debian/rules (closes: #395633) * work around python statvfs 32-bit overflow (closes: #396298) -- Radovan Garabík Wed, 1 Nov 2006 17:09:52 +0200 pydf (0.9.9) unstable; urgency=low * find automatically mountpoints for arguments (closes: #140483), thanks to Jürgen A. Erhard -- Radovan Garabík Thu, 30 Mar 2006 18:34:49 +0200 pydf (0.9.8.5) unstable; urgency=low * added sshfs to the list of remote filesystems * added udf to the list of filesystem that are always full (thanks to Benoît Dejean) -- Radovan Garabík Fri, 2 Sep 2005 23:12:41 +0200 pydf (0.9.8.4) unstable; urgency=low * mountfile can be a list now, pydf will try each of them * fallback to parsing mount(1) output if no mountfile is available (this adds support for many different operating systems, e.g. MacOSX) -- Radovan Garabík Mon, 22 Aug 2005 11:01:01 +0200 pydf (0.9.8.3) unstable; urgency=low * failback to default size when 'resize' is not present (closes: #320564) * Suggest xutils (for 'resize') * better barsize rounding -- Radovan Garabík Wed, 3 Aug 2005 10:24:40 +0200 pydf (0.9.8.2) unstable; urgency=low * use F_BSIZE instead of F_FRSIZE (closes: #289527) -- Radovan Garabík Tue, 2 Aug 2005 12:54:30 +0200 pydf (0.9.8.1) unstable; urgency=low * change forgotten FILL_THRESH value from ridiculously low value back to 0.95, thanks to Lasse Pommerenke for noticing (closes: #318968) -- Radovan Garabík Tue, 19 Jul 2005 09:34:41 +0200 pydf (0.9.8) unstable; urgency=low * try to detect terminal size * round values to nearest number (closes: #278683, #315273), note that df(1) sometimes rounds the values incorrectly -- Radovan Garabík Sat, 30 Apr 2005 16:05:11 +0200 pydf (0.9.7) unstable; urgency=low * overall reworking, brought up in sync with newer python versions * accepts mountpoints as arguments (closes: #140483), thanks to Josip Rodin * only necessary filesystems are queried (closes: #280907) -- Radovan Garabik Wed, 5 Jan 2005 20:28:28 +0100 pydf (0.9.6) unstable; urgency=low * modified dependencies for new python numbering scheme (closes: #118248) * mention /etc/pydfrc in manpage (closes: #108167) -- Radovan Garabik Mon, 5 Nov 2001 10:47:10 +0100 pydf (0.9.5) unstable; urgency=low * corercted typo in manpage (closes #99878). -- Radovan Garabik Mon, 4 Jun 2001 13:07:06 +0200 pydf (0.9.4) unstable; urgency=low * move Build-Depends where it belongs. * depends on python | python2 -- Radovan Garabik Fri, 23 Feb 2001 21:41:04 +0100 pydf (0.9.3) unstable; urgency=low * rebuilt with a new GPG key -- Radovan Garabik Fri, 1 Sep 2000 08:27:58 +0200 pydf (0.9.2) unstable; urgency=low * added debhelper to Build-Depends -- Radovan Garabik Wed, 16 Feb 2000 16:08:24 +0100 pydf (0.9.1) unstable; urgency=low * Fixed stupid bug affecting those with broken python on RedHat. Thanks to Keith M. Briggs for pointing this out. -- Radovan Garabik Fri, 14 Jan 2000 13:09:13 +0100 pydf (0.9) unstable; urgency=low * More colour definitions * Upgraded Standards-Version * Corrected typo in the manpage * Included pointer to stat(1) in README -- Radovan Garabik Thu, 6 Jan 2000 17:24:32 +0100 pydf (0.8.1) unstable; urgency=low * NMU (sponsored). * Set control file so Radovan is listed properly as the maintainer. -- Chris Lawrence Tue, 4 Jan 2000 02:11:01 -0600 pydf (0.8) unstable; urgency=low * statvfs checks for errors - e.g., if you do not have rights to statfs the filesystem, pydf would not crash * use getopt for argument parsing * added --block-size, --local, --all options * Radovan Garabik is the person responsible for this package; I am his sponsor and uploading it on his behalf. -- Chris Lawrence Tue, 5 Oct 1999 20:25:25 +0200 pydf (0.7) unstable; urgency=low * build with new debhelper - FHS compliant * a couple of spelling errors in README fixed -- Radovan Garabik Sat, 18 Sep 1999 10:34:28 +0200 pydf (0.6) unstable; urgency=low * now displays size correctly for filesystem with FRSIZE != BSIZE, workaround for some broked pythons (see 0.3) still valid * documentation update * increased version number from 0.4 :-) -- Radovan Garabik Wed, 15 Sep 1999 20:52:21 +0200 pydf (0.5) unstable; urgency=low * fixed typo preventing correct display of small sizes -- Radovan Garabik Wed, 1 Sep 1999 13:19:38 +0200 pydf (0.4) unstable; urgency=low * network filesystems with block size 0 are now recognized as network filesystems, not as special filesystems * workaround for older python interpreter without os.statvfs function -- Radovan Garabik Mon, 30 Aug 1999 19:53:50 +0200 pydf (0.3) unstable; urgency=low * Restore original colour after itself * Should work on RedHat 6.0 now * Improved colour scheme * Added --mounts option -- Radovan Garabik Fri, 27 Aug 1999 17:24:45 +0200 pydf (0.2) unstable; urgency=low * Initial Release. -- Radovan Garabik Thu, 26 Aug 1999 19:16:29 +0200 Local variables: mode: debian-changelog End: pydf-10/debian/compat0000644000000000000000000000000210237716107011550 0ustar 4 pydf-10/debian/copyright0000644000000000000000000000023410621543637012307 0ustar This package was written by Radovan Garabík Copyright: Public domain. Do whatever you want to do with this program. pydf-10/pydf.10000644000000000000000000000362511356403624010162 0ustar .TH PYDF 1 .SH NAME pydf \- report colourised filesystem disk space usage .SH SYNOPSIS .B pydf .I "[options]" .I "[file]" .SH "DESCRIPTION" .B pydf is a python script that displays the amount of disk space available on the mounted filesystems, using different colours for different types of filesystems. Output format is completely customizable. .TP If an optional .I "file" argument is given, pydf displays just information about filesystem containing the file(s), otherwise it displays information about all mounted filesystems. .SH OPTIONS .TP .B \-\-help Show summary of options. .TP .B \-v, \-\-version Show version of program. .TP .B \-a, \-\-all include filesystems having 0 blocks .TP .B \-h, \-\-human-readable print sizes in human readable format (e.g., 133K 2341M 2448G) .TP .B \-H, \-\-si likewise, but use powers of 1000 not 1024 .TP .B \-\-block-size=SIZE use SIZE-byte blocks .TP .B \-k, \-\-kilobytes like --block-size=1024 .TP .B \-i, \-\-inodes show information about inodes instead of blocks .TP .B \-l, \-\-local limit listing to local filesystems .TP .B \-m, \-\-megabytes like --block-size=1048576 .TP .B \-g, \-\-gigabytes like --block-size=1073741824 .TP .B \-\-blocks use filesystem native block size .TP .B \-\-bw do not use colours .TP .B --mounts=FILE file to get mount information from. On normal linux system, only /etc/mtab or /proc/mounts make sense. Use /proc/mounts when /etc/mtab is corrupted or inaccessible (the output looks a bit weird in this case though) .TP .B \-B, \-\-show\-binds Show also mount --bind mounted filesystems. .SH "BUGS" When running with python3, mountpoints with out-of-locale non ASCII names will not be displayed (due to inability of os.statvfs to use bytes instead of strings). .SH "FILES" .TP .B /etc/pydfrc main configuration file .TP .B ~/.pydfrc per-user configuration file .SH "SEE ALSO" .BR df "(1) .SH AUTHOR Radovan Garab\('ik pydf-10/pydfrc0000644000000000000000000000627611361347025010353 0ustar # Configuration file for pydf # # # colours can be: # 'none' - no change from previous colour # 'default' - default system colour # # special attributes: # 'bold' # 'underline' # 'blink' # 'reverse' # 'concealed' # # foreground: # 'black' # 'red' # 'green' # 'yellow' # 'blue' # 'magenta' # 'cyan' # 'white' # # background: # 'on_black' # 'on_red' # 'on_green' # 'on_yellow' # 'on_blue' # 'on_magenta' # 'on_cyan' # 'on_white' # # beep: # 'beep' # # # or any combination of these, separated with commas # normal text colour - used to switch to after one row is displayed normal_colour = 'default' # colour of the header header_colour = 'yellow' # colour for local filesystems local_fs_colour = 'default' # colour for remote filesystems (such as nfs, samba, afs....) remote_fs_colour = 'green' # colour for special filesystems (such as proc, pty) special_fs_colour = 'blue' # colour for readonly mounted filesystems readonly_fs_colour = 'cyan' # colour for filesystems with usage > FILL_THRESH filled_fs_colour = 'red' # colour for filesystems with usage > FULL_THRESH full_fs_colour = 'on_red', 'green', 'blink' # default format for displaying sizes "-h" or "-H" or "-m" or "-k" or "--blocks" sizeformat = "-h" # string used to separace columns in the table column_separator = ' ' # colour of the string column_separator_colour = 'none' # if the screen is wider than necessary, stretch the bar: # 0 - do not stretch # 1 - stretch to fill the whole screen # real number in between - stretch by this ratio of free space stretch_screen = 0.3 # filesystem filled up over this limit (in percents) is displayed # with filled_fs_colour (to show it is dangerously filled up) FILL_THRESH = 95.0 # filesystem filled up over this limit is displayed with # full_fs_colour (to show it is FULL) FULL_THRESH = 99.0 # Format used to display information: (keyword, size, justify). # keyword - one of 'fs' 'fstype' 'size' 'used' 'avail' 'perc' 'bar' 'on'. # size - if 'size' is integer, it is a minimal possible column width of the entry # if 'size' is float, it is a minimal column width in percent of screen width # # justify is either "l" for left justify, "r" for right justify or "c" for # center. # You can use any order and any combination of keywords, but # be careful not to exceed the size of your screen #format = [ # ('fs', 15, "l"), ('size', 9, "r"), # ('used', 9, "r"), ('avail', 9, "r"), ('perc', 5, "r"), # ('bar', 8, "l"), ('on', 16, "l") # ] # this is somewhat conservative # use fixed width for everything, since you want it readable # only the bar is specified by percentage, because you want it dynamic format = [ ('fs', 10, "l"), ('size', 5, "r"), ('used', 5, "r"), ('avail', 5, "r"), ('perc', 5, "r"), ('bar', 0.1, "l"), ('on', 11, "l") ] # character to display filesystem size bar barchar = '#' # fill the empty space of the size bar with this character bar_fillchar = '.' # hide 'mount --bind' binds? hidebinds = True # list of files to try to get mount information from # on normal linux systems only /etc/mtab or /proc/mounts make sense mountfile = ['/etc/mtab', '/etc/mnttab', '/proc/mounts'] pydf-10/INSTALL0000644000000000000000000000053610302326123010151 0ustar You must have python installed (at least version 2.3, or version 2.2. with optparse package) edit first line of pydf to point to your python interpreter, copy pydf somewhere into your path, copy pydf.1 where your manpages reside (e.g. /usr/local/man/man1) and copy pydfrc into /etc/pydfrc, or ~/.pydfrc Modify /etc/pydfrc according to your taste. pydf-10/COPYING0000644000000000000000000000023510621544675010171 0ustar This package was written by Radovan Garabík Copyright: Public domain. Do whatever you want to do with this program.