From: Jesse Rosenthal Date: Fri, 31 Oct 2014 17:33:25 +0000 (+2000) Subject: [PATCH] test: Make gen-threads work with python3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b2a5ce00131df7e66592d3ea403b5021873a6bda;p=notmuch-archives.git [PATCH] test: Make gen-threads work with python3 --- diff --git a/e7/0e32c2506da51ed7ba3d3c58743786a8726830 b/e7/0e32c2506da51ed7ba3d3c58743786a8726830 new file mode 100644 index 000000000..5a2b45abc --- /dev/null +++ b/e7/0e32c2506da51ed7ba3d3c58743786a8726830 @@ -0,0 +1,78 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 36907431FBC + for ; Fri, 31 Oct 2014 10:33:41 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -2.3 +X-Spam-Level: +X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id yeClcEKzzHwo for ; + Fri, 31 Oct 2014 10:33:35 -0700 (PDT) +Received: from smtpauth.johnshopkins.edu (smtpauth.johnshopkins.edu + [162.129.8.150]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 9CE73431FAF + for ; Fri, 31 Oct 2014 10:33:35 -0700 (PDT) +X-IronPort-AV: E=Sophos;i="5.07,295,1413259200"; d="scan'208";a="110278986" +Received: from guppy.hwcampus.jhu.edu (HELO localhost) ([10.161.32.234]) + by IPEB2.johnshopkins.edu with ESMTP/TLS/AES128-SHA; + 31 Oct 2014 13:33:33 -0400 +From: Jesse Rosenthal +To: notmuch@notmuchmail.org +Subject: [PATCH] test: Make gen-threads work with python3 +Date: Fri, 31 Oct 2014 13:33:25 -0400 +Message-Id: <1414776805-30000-1-git-send-email-jrosenthal@jhu.edu> +X-Mailer: git-send-email 2.1.2 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Fri, 31 Oct 2014 17:33:41 -0000 + +python3 doesn't allow dictionaries to be initialized with non-string +keywords. This presents problems on systems in which "python" means +"python3". We instead initalize the dictionary using the dict +comprehension and then update it with the values from the tree. This +will work with both python2 and python3. +--- + test/gen-threads.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/test/gen-threads.py b/test/gen-threads.py +index 9fbb847..70fb1f6 100644 +--- a/test/gen-threads.py ++++ b/test/gen-threads.py +@@ -2,7 +2,6 @@ + # argv[1]. Each output line is a thread structure, where the n'th + # field is either a number giving the parent of message n or "None" + # for the root. +- + import sys + from itertools import chain, combinations + +@@ -28,6 +27,7 @@ while queue: + else: + # Expand node to_expand[0] with each possible set of children + for children in subsets(free): +- ntree = dict(tree, **{child: to_expand[0] for child in children}) ++ ntree = {child: to_expand[0] for child in children} ++ ntree.update(tree) + nfree = free.difference(children) + queue.append((ntree, nfree, to_expand[1:] + tuple(children))) +-- +2.1.2 +