From patchwork Wed Jun 27 02:14:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 935223 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41Fmhm2ZcPz9s0w for ; Wed, 27 Jun 2018 12:15:18 +1000 (AEST) Received: from localhost ([::1]:56125 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXzzG-0006f6-PA for incoming@patchwork.ozlabs.org; Tue, 26 Jun 2018 22:15:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fXzyg-0006el-Db for qemu-devel@nongnu.org; Tue, 26 Jun 2018 22:14:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fXzyb-0001pu-Ge for qemu-devel@nongnu.org; Tue, 26 Jun 2018 22:14:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60826) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fXzyb-0001nb-9H for qemu-devel@nongnu.org; Tue, 26 Jun 2018 22:14:33 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D8B0308624F; Wed, 27 Jun 2018 02:14:31 +0000 (UTC) Received: from localhost (ovpn-116-35.gru2.redhat.com [10.97.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD7868F6F5; Wed, 27 Jun 2018 02:14:24 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Tue, 26 Jun 2018 23:14:17 -0300 Message-Id: <20180627021423.18404-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 27 Jun 2018 02:14:31 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 0/6] docker: Port to Python 3 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Cleber Rosa , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This series makes tests/docker/docker.py compatible with both Python 2 and Python 3, and adds type annotation to make maintenance easier in the future. A note about dockerfile encoding -------------------------------- One decision I made while working on this was to open dockerfiles in text mode instead of binary mode, to make the code simpler and safer. This means we won't support dockerfiles that are not valid utf-8 data, but I see that as a feature and not a bug. :) Opening dockerfiles in binary mode and treating its contents as byte sequences instead of text is possible if we really want to, but I don't think it would be worth the extra code complexity. Eduardo Habkost (6): docker: Use BytesIO instead of StringIO docker: Always return int on run() docker: Add type annotations docker: Use os.environ.items() instead of .iteritems() docker: Make _get_so_libs() work on Python 3 docker: Open dockerfiles in text mode tests/docker/docker.py | 115 ++++++++++++++++++++++++++++------------- 1 file changed, 79 insertions(+), 36 deletions(-) base-commit: bd4e4a387aa733e40270a7406c7d111f2292de65 prerequisite-patch-id: 83051ebcf718afae38540902b60a0f8e9f91c174 prerequisite-patch-id: 1a35c71f2a58523de78e3ea2e44c5ef1f84bcc4a prerequisite-patch-id: 5206b4c5a6797ea17eb763da6203e1881d379f2c