From patchwork Fri Sep 17 16:23:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 514195 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2395072jao; Fri, 17 Sep 2021 09:32:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4u8ffMs2yiXcbIYkUXFDwc20AVhXNTPMCVMxIo6048uMtpNtTAiPz4uYikmJ21r47mJyT X-Received: by 2002:ac8:6690:: with SMTP id d16mr1756947qtp.285.1631896346322; Fri, 17 Sep 2021 09:32:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631896346; cv=none; d=google.com; s=arc-20160816; b=kquC04JC8yD5GIpWm8RPZkCH7KNu+cUsO7TzAISRrS4P7wPJ0sB48RhCLuu4CsbYq/ 6K9p2t0f9AoLrmgczTwVGa/dBk9KkS1725a3yuDeyoAPO/8KhnGoQ4/JKqHp9UaH3rzY He6tYbnwipKnkM5+INzf4HCt2D9MqoBVVWoRd5/DvVFJa5OrD4VFFdb10c+wSuBFwB7+ Y6KgYdNH/5jup0GIQng0A4ypQLk6keoy3hY8fZCHEEX8ynAKNohTQ65mKFaX7YiJ8oan eWpWymDt9FUa3L+vn4JaolQM+ci95q2cIqUs7cCKPPUBWL2cwd1D+YawAl7sSBkYGk6O wJZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=6650I+sSBOEI7t+EMaHgrH7WtFrcTMt2scZY/FxCdUo=; b=IZ0dVZpqjqZEAMRFze0j9NwUzH2FAyQd1qjoG0D0+V6D9tuorcs38e+JFaviK82F5C NFbB+u83z7YjinZOxPUdSYgHvN8xJGWmdtztvWgIQgMemdULasegkYfBMrXT6E0hNTDk jGk+P3MsnDK0rzW6UFMJc3YrcbVKYGQMPelFqG63YEECkjKgJXrw00RpcTgLkfB4ZsMM z6twgKi4U6OplN24AC11L5zNWgM1R+rYRifvirMAvPo7rAsEChq60P675vkwGbU23pZW MPqRvdGLU9jmQl56EEbgMc5A3ywVWyfH1CdsvvuV893bXCYCfaZv2h1iAKSADEA5RfGa FhTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DBFcLQWE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l28si3712915qtu.103.2021.09.17.09.32.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 Sep 2021 09:32:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DBFcLQWE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43482 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mRGmn-0007zV-QI for patch@linaro.org; Fri, 17 Sep 2021 12:32:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mRGeS-0003Xk-M1 for qemu-devel@nongnu.org; Fri, 17 Sep 2021 12:23:50 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:33617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mRGeQ-0005Xo-7V for qemu-devel@nongnu.org; Fri, 17 Sep 2021 12:23:48 -0400 Received: by mail-wm1-x331.google.com with SMTP id 192-20020a1c04c9000000b002f7a4ab0a49so7881148wme.0 for ; Fri, 17 Sep 2021 09:23:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6650I+sSBOEI7t+EMaHgrH7WtFrcTMt2scZY/FxCdUo=; b=DBFcLQWEEe/rbjcBv9MGtHw7F6smFCW+8N1DpFY8NFhHLiv10JLZ3bjg7/RxuaCMW4 9g6j+G+FQkju3M/QjE1vKwbJftLaRob1eZMfxjhDS2UkNFswAl3LS25H9wjfYQ0xQe8Y E6cFK49on4CBo+cMIzRJYU7YtRJFr2XC9E09u37xmnZ8KZPOsfZccgjeDluNYc4o2ByV n8ZC8uxfT6ndI/G3KxCS1XtTi+SxVut5YXZ0WgUqTWi6a4Tz8O0qGt3zBbaS1v3rRsH/ 6Bx0ammYrgVTpmSgrHYjtA5hCVHPVyISKKoRcEnnnUyJRU/3QQ1N7SRxCd5pA2nUXMk2 t/HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6650I+sSBOEI7t+EMaHgrH7WtFrcTMt2scZY/FxCdUo=; b=q62e6iHELbDJ4ssSyhBCrImgom7qQOZiBRmtD/hndi17wLQ4T3TQPk2gGu3/ljb3oI giF1C1DE0o9TGZsTirYnwOHDAD1ZoeGs/qM74SvCnFqkgkPli63J1b40ofpAEIQM4/gZ vTyP55OtrOmCgKF3p0cdn/1bO7Vlybhx15m0qt6j/rg7g6PFIwe/pHqjeYwoY8qabLUW zTXxZBdifVte6fUQB8CdDM544iZPjwohRbE6GHhBn+A+JSHM6pzNCwBZkvU9IfP02taG 5V8gbfA/FujFzEFh6ur9nh8OAwes6kBGdM907EGICQt4pFK+OiA0Vupem9vrbu3EV+Ow s9dg== X-Gm-Message-State: AOAM533Ic4Tg+C4snEAho2R1y8sjA+HSP2iwjgbTlzydahas0E+kUHXa GAnvc2+jCzm08mR+HvrhohQleg== X-Received: by 2002:a1c:ed0a:: with SMTP id l10mr11535695wmh.140.1631895824891; Fri, 17 Sep 2021 09:23:44 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id s24sm6522268wmh.34.2021.09.17.09.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Sep 2021 09:23:39 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BA0C91FF9D; Fri, 17 Sep 2021 17:23:32 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 06/11] python: Update for pylint 2.10 Date: Fri, 17 Sep 2021 17:23:27 +0100 Message-Id: <20210917162332.3511179-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210917162332.3511179-1-alex.bennee@linaro.org> References: <20210917162332.3511179-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, berrange@redhat.com, Eduardo Habkost , =?utf-8?q?Alex_Benn=C3=A9e?= , f4bug@amsat.org, stefanha@redhat.com, crosa@redhat.com, pbonzini@redhat.com, John Snow , aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: John Snow A few new annoyances. Of note is the new warning for an unspecified encoding when opening a text file, which actually does indicate a potentially real problem; see https://www.python.org/dev/peps/pep-0597/#motivation Use LC_CTYPE to determine an encoding to use for interpreting QEMU's terminal output. Note that Python states: "language code and encoding may be None if their values cannot be determined" -- use a platform default as a backup. Signed-off-by: John Snow Message-Id: <20210916040955.628560-2-jsnow@redhat.com> Reviewed-by: Alex Bennée Tested-by: Alex Bennée Signed-off-by: Alex Bennée --- python/qemu/machine/machine.py | 9 ++++++++- python/setup.cfg | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) -- 2.30.2 Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py index a7081b1845..51b6e79a13 100644 --- a/python/qemu/machine/machine.py +++ b/python/qemu/machine/machine.py @@ -19,6 +19,7 @@ import errno from itertools import chain +import locale import logging import os import shutil @@ -290,8 +291,14 @@ def get_pid(self) -> Optional[int]: return self._subp.pid def _load_io_log(self) -> None: + # Assume that the output encoding of QEMU's terminal output + # is defined by our locale. If indeterminate, use a platform default. + _, encoding = locale.getlocale() + if encoding is None: + encoding = locale.getpreferredencoding(do_setlocale=False) if self._qemu_log_path is not None: - with open(self._qemu_log_path, "r") as iolog: + with open(self._qemu_log_path, "r", + encoding=encoding) as iolog: self._iolog = iolog.read() @property diff --git a/python/setup.cfg b/python/setup.cfg index 83909c1c97..0f0cab098f 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -104,6 +104,7 @@ good-names=i, [pylint.similarities] # Ignore imports when computing similarities. ignore-imports=yes +ignore-signatures=yes # Minimum lines number of a similarity. # TODO: Remove after we opt in to Pylint 2.8.3. See commit msg.