python-linux-procfs makes no use of sysctl.py, nor does tuna
It appears to be code that was written to abstract some common
operations reading procfs, but was never actually put into use.
Just delete it
Signed-off-by: John Kacur <jkacur(a)redhat.com>
---
MANIFEST | 1 -
procfs/__init__.py | 1 -
procfs/sysctl.py | 68 ----------------------------------------------
3 files changed, 70 deletions(-)
delete mode 100755 procfs/sysctl.py
diff --git a/MANIFEST b/MANIFEST
index 5e86f6b3795b..ebbd4998d03a 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4,7 +4,6 @@ Makefile
pflags-cmd.py
procfs/__init__.py
procfs/procfs.py
-procfs/sysctl.py
procfs/utilist.py
rpm/SPECS/python-linux-procfs.spec
setup.py
diff --git a/procfs/__init__.py b/procfs/__init__.py
index 86c34b46cf0c..071c54dacab8 100644
--- a/procfs/__init__.py
+++ b/procfs/__init__.py
@@ -26,5 +26,4 @@ __author__ = "Arnaldo Carvalho de Melo
<acme(a)redhat.com>"
__license__ = "GPLv2 License"
from .procfs import *
-from .sysctl import *
from .utilist import *
diff --git a/procfs/sysctl.py b/procfs/sysctl.py
deleted file mode 100755
index 727b0bf60aad..000000000000
--- a/procfs/sysctl.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#! /usr/bin/python3
-# -*- python -*-
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2007 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-class sysctl:
- def __init__(self):
- self.cache = {}
-
- def __getitem__(self, key):
- if key not in self.cache:
- value = self.read(key)
- if value is None:
- return None
- self.cache[key] = value
-
- return self.cache[key]
-
- def __setitem__(self, key, value):
- oldvalue = self[key]
-
- if oldvalue is None:
- raise IOError
- elif oldvalue != value:
- self.write(key, value)
- self.cache[key] = value
-
- def keys(self):
- return list(self.cache.keys())
-
- def read(self, key):
- try:
- f = open("/proc/sys/%s" % key.replace(".",
"/"))
- except:
- return None
- value = f.readline().strip()
- f.close()
- return value
-
- def write(self, key, value):
- try:
- f = open("/proc/sys/%s" % key.replace(".",
"/"), "w")
- except:
- return
- f.write(value)
- f.close()
-
- def refresh(self):
- for key in list(self.cache.keys()):
- del self.cache[key]
- value = self.read(key)
- if value is not None:
- self.cache[key] = value
--
2.31.1
Show replies by date