-#!/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>
"""Script for managing test package repositories and unittest data"""
import argparse
-import ConfigParser
+import configparser
import json
import logging
import os
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)
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:
# 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:
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'])
(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