← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-migrate-librarian-content-md5 into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-migrate-librarian-content-md5 into launchpad:master.

Commit message:
Port migrate-librarian-content-md5.py to subprocess

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/387775

The commands module no longer exists in Python 3.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-migrate-librarian-content-md5 into launchpad:master.
diff --git a/scripts/migrate-librarian-content-md5.py b/scripts/migrate-librarian-content-md5.py
index 16929b3..6dd3b9a 100755
--- a/scripts/migrate-librarian-content-md5.py
+++ b/scripts/migrate-librarian-content-md5.py
@@ -9,8 +9,8 @@ __metaclass__ = type
 
 import _pythonpath
 
-import commands
 import os
+import subprocess
 import sys
 
 import scandir
@@ -33,7 +33,8 @@ def main(path, minimumID=0):
             if databaseID < minimumID:
                 continue
             filename = os.path.join(dirpath, filename)
-            md5sum = commands.getoutput('md5sum ' + filename).split(' ', 1)[0]
+            md5sum = subprocess.check_output(
+                ['md5sum', filename], universal_newlines=True).split(' ', 1)[0]
             yield databaseID, md5sum