From 3cfafb525f6e98f5a8fb647d69cb09b343f32ccc Mon Sep 17 00:00:00 2001 From: Guillaume Chazarain Date: Sun, 3 Feb 2013 19:50:02 +0100 Subject: [PATCH] Update python requirements --- README | 7 +++---- iotop/data.py | 28 ++++++++-------------------- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/README b/README index 457bc20..cf9e050 100644 --- a/README +++ b/README @@ -1,8 +1,7 @@ Iotop is a Python program with a top like UI used to show of behalf of which -process is the I/O going on. It requires Python >= 2.5 (or Python >= 2.4 with -the ctypes module) and a Linux kernel >= 2.6.20 with the CONFIG_TASK_DELAY_ACCT -CONFIG_TASKSTATS, CONFIG_TASK_IO_ACCOUNTING and CONFIG_VM_EVENT_COUNTERS options -on. +process is the I/O going on. It requires Python >= 2.7 and a Linux kernel >= +2.6.20 with the CONFIG_TASK_DELAY_ACCT CONFIG_TASKSTATS, +CONFIG_TASK_IO_ACCOUNTING and CONFIG_VM_EVENT_COUNTERS options on. To run a local version of iotop: diff --git a/iotop/data.py b/iotop/data.py index 6dae4b8..e623c37 100644 --- a/iotop/data.py +++ b/iotop/data.py @@ -31,19 +31,11 @@ import time # # Check for requirements: # o Linux >= 2.6.20 with I/O accounting and VM event counters -# o Python >= 2.5 or Python 2.4 + ctypes # ioaccounting = os.path.exists('/proc/self/io') try: - import ctypes -except ImportError: - has_ctypes = False -else: - has_ctypes = True - -try: from iotop.vmstat import VmStat vmstat_f = VmStat() except: @@ -51,19 +43,15 @@ except: else: vm_event_counters = True -if not ioaccounting or not has_ctypes or not vm_event_counters: +if not ioaccounting or not vm_event_counters: print('Could not run iotop as some of the requirements are not met:') - if not ioaccounting or not vm_event_counters: - print('- Linux >= 2.6.20 with') - if not ioaccounting: - print(' - I/O accounting support ' \ - '(CONFIG_TASKSTATS, CONFIG_TASK_DELAY_ACCT, ' \ - 'CONFIG_TASK_IO_ACCOUNTING)') - if not vm_event_counters: - print(' - VM event counters (CONFIG_VM_EVENT_COUNTERS)') - if not has_ctypes: - print('- Python >= 2.5 or Python 2.4 with the ctypes module') - + print('- Linux >= 2.6.20 with') + if not ioaccounting: + print(' - I/O accounting support ' \ + '(CONFIG_TASKSTATS, CONFIG_TASK_DELAY_ACCT, ' \ + 'CONFIG_TASK_IO_ACCOUNTING)') + if not vm_event_counters: + print(' - VM event counters (CONFIG_VM_EVENT_COUNTERS)') sys.exit(1) from iotop import ioprio, vmstat -- 2.11.4.GIT