diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-07-10 14:25:39 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-07-10 14:25:39 -0300 |
commit | 8d29de0d4abe31d41969aa3037258a99844515db (patch) | |
tree | 599bcdd56f0e26bfefc4feaefe6c92b7519e3ef6 | |
parent | 2d52e2eac401ddade9aa47e8ae1accd8dbd948aa (diff) | |
download | tuna-8d29de0d4abe31d41969aa3037258a99844515db.tar.gz |
tuna: Remove the requires for python-inet_diag
It now just checks if it is present and if it isn't just doesn't
offer the -n/--show_sockets option.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | rpm/SPECS/tuna.spec | 3 | ||||
-rwxr-xr-x | tuna-cmd.py | 32 |
2 files changed, 21 insertions, 14 deletions
diff --git a/rpm/SPECS/tuna.spec b/rpm/SPECS/tuna.spec index 270f595..a54e6dc 100644 --- a/rpm/SPECS/tuna.spec +++ b/rpm/SPECS/tuna.spec @@ -13,7 +13,8 @@ BuildRequires: python-devel Requires: python-ethtool Requires: python-linux-procfs >= 0.4.2 Requires: python-schedutils >= 0.2 -Requires: python-inet_diag +# This really should be a Suggests... +# Requires: python-inet_diag BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %description diff --git a/tuna-cmd.py b/tuna-cmd.py index d18cc1a..919e29e 100755 --- a/tuna-cmd.py +++ b/tuna-cmd.py @@ -14,13 +14,19 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. -import getopt, ethtool, fnmatch, inet_diag, os, procfs, re, schedutils, sys +import getopt, ethtool, fnmatch, os, procfs, re, schedutils, sys from tuna import tuna, sysfs import gettext import locale try: + import inet_diag + have_inet_diag = True +except: + have_inet_diag = False + +try: from sets import Set as set except: # OK, we're modern, having sets as first class citizens @@ -45,7 +51,8 @@ def usage(): print fmt % ('-I, --include', _('Allow all threads to run on') + ' ' + _('CPU-LIST')) print fmt % ('-K, --no_kthreads', _('Operations will not affect kernel threads')) print fmt % ('-m, --move', _('Move selected entities to') + ' ' + _('CPU-LIST')) - print fmt % ('-n, --show_sockets', _('show network sockets in use by threads')) + if have_inet_diag: + print fmt % ('-n, --show_sockets', _('show network sockets in use by threads')) print fmt % ('-p, --priority=[' + _('POLICY') + ']:' + _('RTPRIO'), "%s %s %s %s" % (_('Set thread scheduler tunables:'), @@ -323,17 +330,16 @@ def i18n_init(): def main(): i18n_init() try: - opts, args = getopt.getopt(sys.argv[1:], - "c:CfghiIKmnp:Pq:s:S:t:UvWx", - ("cpus=", "affect_children", - "filter", "gui", "help", - "isolate", "include", - "no_kthreads", "move", - "show_sockets", "priority=", - "show_threads", "irqs=", - "save=", "sockets=", "threads=", - "no_uthreads", "version", "what_is", - "spread")) + short = "c:CfghiIKmp:Pq:s:S:t:UvWx" + long = ["cpus=", "affect_children", "filter", "gui", "help", + "isolate", "include", "no_kthreads", "move", + "show_sockets", "priority=", "show_threads", "irqs=", + "save=", "sockets", "threads=", "no_uthreads", + "version", "what_is", "spread"] + if have_inet_diag: + short += "n" + long.append("show_sockets") + opts, args = getopt.getopt(sys.argv[1:], short, long) except getopt.GetoptError, err: usage() print str(err) |