Patchwork [STABLE] setup: remove set and dict comprehensions

login
register
mail settings
Submitter Gregory Szorc
Date April 21, 2019, 2:21 p.m.
Message ID <9858ba149a92ad9b85f3.1555856510@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/39780/
State Accepted
Headers show

Comments

Gregory Szorc - April 21, 2019, 2:21 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1555856468 25200
#      Sun Apr 21 07:21:08 2019 -0700
# Branch stable
# Node ID 9858ba149a92ad9b85f329c8579a10689d588e28
# Parent  07faf5c65190f8fcc92c0a6663f8b9d223c4ebaa
setup: remove set and dict comprehensions

Yuya observed in a recent review that it is worthwhile to keep
setup.py parseable with Python 2.6 so a useful error message is
seen when attempting to run with Python 2.6.

This commit removes a set and dict comprehension so setup.py
is parseable with Python 2.6.
Yuya Nishihara - April 21, 2019, 10:08 p.m.
On Sun, 21 Apr 2019 07:21:50 -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1555856468 25200
> #      Sun Apr 21 07:21:08 2019 -0700
> # Branch stable
> # Node ID 9858ba149a92ad9b85f329c8579a10689d588e28
> # Parent  07faf5c65190f8fcc92c0a6663f8b9d223c4ebaa
> setup: remove set and dict comprehensions

Queued for stable, thanks.

Patch

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -795,8 +795,8 @@  class hgbuilddoc(Command):
             normalizecrlf('doc/%s.html' % root)
 
         # This logic is duplicated in doc/Makefile.
-        sources = {f for f in os.listdir('mercurial/help')
-                   if re.search(r'[0-9]\.txt$', f)}
+        sources = set(f for f in os.listdir('mercurial/help')
+                      if re.search(r'[0-9]\.txt$', f))
 
         # common.txt is a one-off.
         gentxt('common')
@@ -971,9 +971,12 @@  if py2exehacked:
             res = buildpy2exe.find_needed_modules(self, mf, files, modules)
 
             # Replace virtualenv's distutils modules with the real ones.
-            res.modules = {
-                k: v for k, v in res.modules.items()
-                if k != 'distutils' and not k.startswith('distutils.')}
+            modules = {}
+            for k, v in res.modules.items():
+                if k != 'distutils' and not k.startswith('distutils.'):
+                    modules[k] = v
+
+            res.modules = modules
 
             import opcode
             distutilsreal = os.path.join(os.path.dirname(opcode.__file__),