diff options
author | Jochen Sprickerhof <git@jochen.sprickerhof.de> | 2021-01-31 16:22:55 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2021-02-01 09:01:27 +0100 |
commit | d4864b85a1f4279aa42e8800189b520f7f722352 (patch) | |
tree | 71e193d6fa5c700c47ce3a5df359c598d3e56629 | |
parent | 86a2b16a5bea918e5b073a3f93c89d4950239a1a (diff) |
Adopt to Python 3
-rwxr-xr-x | manage.py | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # vim:fileencoding=utf-8:et:ts=4:sw=4:sts=4 # # Copyright (C) 2015 Intel Corporation <markus.lehtonen@linux.intel.com> @@ -20,7 +20,7 @@ """Script for managing test package repositories and unittest data""" import argparse -import ConfigParser +import configparser import json import logging import os @@ -55,9 +55,9 @@ def run_cmd(cmd, opts=None, capture_stdout=False, capture_stderr=False, LOG.debug("Running command: '%s'", ' '.join(args)) popen = subprocess.Popen(args, stdin=stdin, stdout=stdout, stderr=stderr, env=env) - stdout, stderr = popen.communicate(input_data) - ret_out = stdout.splitlines() if stdout else stdout - ret_err = stderr.splitlines() if stderr else stderr + stdout, stderr = popen.communicate(input_data.encode() if input_data else None) + ret_out = stdout.decode().splitlines() if stdout else stdout + ret_err = stderr.decode().splitlines() if stderr else stderr return (popen.returncode, ret_out, ret_err) @@ -240,7 +240,7 @@ def cmd_build(args): raise Exception("No repositories found, run 'import' in order to " "initialize test package repositories for building") # Read build config - config = ConfigParser.RawConfigParser() + config = configparser.RawConfigParser() config.read('build.conf') for repodir in repos: @@ -351,7 +351,7 @@ def import_repo(datadir, repodir, force): # Create child mapping of commit history commits = defaultdict(list) - for sha1, info in manifest['commits'].iteritems(): + for sha1, info in manifest['commits'].items(): if 'parents' not in info: commits['root'].append(sha1) else: @@ -367,7 +367,7 @@ def import_repo(datadir, repodir, force): import_commit_history('root') # Re-create tags - for sha1, tag in manifest['tags'].iteritems(): + for sha1, tag in manifest['tags'].items(): signature_data = "object %s\ntype %s\ntag %s\ntagger %s\n\n%s\n" % ( tag['object'], tag['type'], tag['tag'], tag['tagger'], tag['message']) @@ -377,7 +377,7 @@ def import_repo(datadir, repodir, force): (new_sha1, sha1) # Re-create refs - for ref, sha1 in manifest['refs'].iteritems(): + for ref, sha1 in manifest['refs'].items(): git_cmd('update-ref', [ref, sha1], True) # Forcefully set HEAD |