summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-02-24 20:04:03 +0100
committerGuido Günther <agx@sigxcpu.org>2016-02-24 20:04:03 +0100
commit4e704c27a7014d0b1cd660b9f5c233787a798c14 (patch)
tree28fdf35c22d5fbdfe310a427c90e9c31ae86744e
parenta2e8aeb34bc615cc9c0082951721971bb141f20a (diff)
parent11ca10034c04267da8b00d2ef940b0548a13ef42 (diff)
Merge branch 'master' into debian/master
-rw-r--r--setup.py2
-rw-r--r--tests/test_pkg.py14
-rw-r--r--tests/test_systemd.py2
-rwxr-xr-xwhatmaps/command.py12
-rw-r--r--whatmaps/debiandistro.py3
-rw-r--r--whatmaps/pkg.py2
-rw-r--r--whatmaps/process.py1
-rw-r--r--whatmaps/redhatdistro.py1
-rw-r--r--whatmaps/systemd.py2
9 files changed, 19 insertions, 20 deletions
diff --git a/setup.py b/setup.py
index cdadd50..be05caa 100644
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# vim: set fileencoding=utf-8 :
#
# (C) 2010,2014 Guido Günther <agx@sigxcpu.org>
diff --git a/tests/test_pkg.py b/tests/test_pkg.py
index 8006b19..b7707b8 100644
--- a/tests/test_pkg.py
+++ b/tests/test_pkg.py
@@ -40,8 +40,8 @@ class TestPkg(unittest.TestCase):
p._list_contents = '/does/not/matter'
PopenMock = mock.return_value
PopenMock.communicate.return_value = [
- '/package/content',
- '/more/package/content',
+ b'/package/content',
+ b'/more/package/content',
]
PopenMock.returncode = 0
result = p._get_contents()
@@ -62,11 +62,11 @@ class TestPkg(unittest.TestCase):
p = Pkg('doesnotmatter')
p._list_contents = '/does/not/matter'
PopenMock = mock.return_value
- PopenMock.communicate.return_value = ['\n'.join([
- '/lib/foo.so.1',
- '/lib/bar.so',
- '/not/a/shared/object',
- '/not/a/shared/object.soeither',
+ PopenMock.communicate.return_value = [b'\n'.join([
+ b'/lib/foo.so.1',
+ b'/lib/bar.so',
+ b'/not/a/shared/object',
+ b'/not/a/shared/object.soeither',
])]
PopenMock.returncode = 0
result = p.shared_objects
diff --git a/tests/test_systemd.py b/tests/test_systemd.py
index 2fbdfdc..f5af3c9 100644
--- a/tests/test_systemd.py
+++ b/tests/test_systemd.py
@@ -47,7 +47,7 @@ class TestSystemd(unittest.TestCase):
CGroup: name=systemd:/system/libvirt-bin.service
├─ 952 /usr/sbin/libvirtd
└─1355 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf
- """
+ """.encode('utf-8')
with patch('os.path.exists', return_value=True):
with patch('subprocess.Popen') as mock:
PopenMock = mock.return_value
diff --git a/whatmaps/command.py b/whatmaps/command.py
index c39b06d..0f8e433 100755
--- a/whatmaps/command.py
+++ b/whatmaps/command.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python -u
+#!/usr/bin/python3 -u
# vim: set fileencoding=utf-8 :
#
# (C) 2010,2014 Guido Günther <agx@sigxcpu.org>
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-from __future__ import print_function
+
import errno
import glob
@@ -83,7 +83,7 @@ def find_pkgs(procs, distro):
if pkgs:
logging.info("Packages that ship the affected binaries:")
- for pkg in pkgs.values():
+ for pkg in list(pkgs.values()):
logging.info(" Pkg: %s, binaries: %s" % (pkg.name, pkg.procs))
return pkgs
@@ -96,7 +96,7 @@ def find_services(pkgs, distro):
"""
all_services = set()
- for pkg in pkgs.values():
+ for pkg in list(pkgs.values()):
services = set(pkg.services + distro.pkg_services(pkg))
services -= set(distro.pkg_service_blacklist(pkg))
if not services:
@@ -112,7 +112,7 @@ def find_systemd_units(procmap, distro):
"""Find systemd units that contain the given processes"""
units = set()
- for dummy, procs in procmap.items():
+ for dummy, procs in list(procmap.items()):
for proc in procs:
try:
unit = Systemd.process_to_unit(proc)
@@ -201,7 +201,7 @@ def main(argv):
else:
raise
logging.debug("Processes that map them:")
- for exe, pids in restart_procs.items():
+ for exe, pids in list(restart_procs.items()):
logging.debug(" Exe: %s Pids: %s", exe, pids),
if Systemd.is_running():
diff --git a/whatmaps/debiandistro.py b/whatmaps/debiandistro.py
index 2a095d1..32f3774 100644
--- a/whatmaps/debiandistro.py
+++ b/whatmaps/debiandistro.py
@@ -43,6 +43,7 @@ class DebianDistro(Distro):
_pkg_services = { 'apache2-mpm-worker': [ 'apache2' ],
'apache2-mpm-prefork': [ 'apache2' ],
'apache2.2-bin': [ 'apache2' ],
+ 'apache2-bin': [ 'apache2' ],
'dovecot-imapd': [ 'dovecot' ],
'dovecot-pop3d': [ 'dovecot' ],
'exim4-daemon-light': [ 'exim4' ],
@@ -165,7 +166,7 @@ class DebianDistro(Distro):
security_update_origins = klass._security_update_origins()
security_updates = {}
- for pkg in pkgs.values():
+ for pkg in list(pkgs.values()):
cache_pkg = cache[pkg.name]
for cache_version in cache_pkg.version_list:
if pkg.version == cache_version.ver_str:
diff --git a/whatmaps/pkg.py b/whatmaps/pkg.py
index ab9088d..4290d0b 100644
--- a/whatmaps/pkg.py
+++ b/whatmaps/pkg.py
@@ -63,7 +63,7 @@ class Pkg(object):
output = list_contents.communicate()[0]
if list_contents.returncode:
raise PkgError("Failed to list package contents for '%s'" % self.name)
- self._contents = output.split('\n')
+ self._contents = output.decode('utf-8').split('\n')
return self._contents
@property
diff --git a/whatmaps/process.py b/whatmaps/process.py
index 23ed7ab..a39da89 100644
--- a/whatmaps/process.py
+++ b/whatmaps/process.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python -u
# vim: set fileencoding=utf-8 :
#
# (C) 2010,2014 Guido Günther <agx@sigxcpu.org>
diff --git a/whatmaps/redhatdistro.py b/whatmaps/redhatdistro.py
index 9300648..0427c30 100644
--- a/whatmaps/redhatdistro.py
+++ b/whatmaps/redhatdistro.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python -u
# vim: set fileencoding=utf-8 :
#
# (C) 2010,2014 Guido Günther <agx@sigxcpu.org>
diff --git a/whatmaps/systemd.py b/whatmaps/systemd.py
index ef15a26..9bc03b1 100644
--- a/whatmaps/systemd.py
+++ b/whatmaps/systemd.py
@@ -38,7 +38,7 @@ class Systemd(object):
if systemctl_status.returncode:
return None
else:
- parts = output.split()
+ parts = output.decode('utf-8').split()
if parts[0].endswith('.service'):
return parts[0]
elif parts[1].endswith('.service'):