From 91d8ef9254578d749126cd9c04fec397195f3b06 Mon Sep 17 00:00:00 2001
From: Xavier Claessens <xavier.claessens@collabora.com>
Date: Wed, 9 Sep 2015 13:11:25 -0400
Subject: [PATCH] tracker: port to python3

Reviewers: smcv, pwith

Differential Revision: https://phabricator.apertis.org/D413
---
 tracker/automated/test-tracker.py       | 6 +++---
 tracker/common.py                       | 2 +-
 tracker/manual/test-removable-device.py | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tracker/automated/test-tracker.py b/tracker/automated/test-tracker.py
index 0ab6b4a..673537b 100755
--- a/tracker/automated/test-tracker.py
+++ b/tracker/automated/test-tracker.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/python3
 # -*- coding: utf-8 -*-
 
 # Copyright © 2015 Collabora Ltd.
@@ -10,7 +10,7 @@
 
 import unittest
 import os
-import md5
+import hashlib
 import sys
 
 from gi.repository import GLib
@@ -76,7 +76,7 @@ class TrackerTest(unittest.TestCase):
         # Note that this is the path for local storage only, not for removable
         # devices.
         uri = 'file://%s/%s' % (self.homedir, filename)
-        uri_hash = md5.new(uri).hexdigest()
+        uri_hash = hashlib.md5(bytes(uri, encoding='UTF-8')).hexdigest()
         path = '%s/.cache/thumbnails/normal/%s.png' % (self.homedir, uri_hash)
         self.assertTrue(os.path.isfile(path))
 
diff --git a/tracker/common.py b/tracker/common.py
index 28a7de6..c93b0b3 100644
--- a/tracker/common.py
+++ b/tracker/common.py
@@ -28,7 +28,7 @@ class TrackerIndexer():
             'systemctl --user stop tracker-store tracker-miner-fs',
             shell=True)
         subprocess.check_call('tracker-control -r',
-                              stdout=open(os.devnull, 'wb'),
+                              stdout=subprocess.DEVNULL,
                               shell=True)
 
         self.loop = GLib.MainLoop.new(None, False)
diff --git a/tracker/manual/test-removable-device.py b/tracker/manual/test-removable-device.py
index 2f3d9ee..41380d9 100755
--- a/tracker/manual/test-removable-device.py
+++ b/tracker/manual/test-removable-device.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/python3
 # -*- coding: utf-8 -*-
 
 # Copyright © 2015 Collabora Ltd.
-- 
GitLab