From a9cfe25068c593aa2e59d98e21e80dbfc9b1bbdc Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Mon, 24 Apr 2017 07:54:15 -0700 Subject: [PATCH] Sort the results of os.walk in setup.py (#1281) os.walk need not provide its results in any specific order. So, sorting might help with situations like that described in #1280. Even if not, it could help avoid some very mysterious bugs in the future that arise from different orders in which Hy's modules are imported. --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 546cfa1..ce52007 100755 --- a/setup.py +++ b/setup.py @@ -53,8 +53,8 @@ class Install(install): def run(self): # Import each Hy module to ensure it's compiled. import os, importlib - for dirpath, _, filenames in os.walk("hy"): - for filename in filenames: + for dirpath, _, filenames in sorted(os.walk("hy")): + for filename in sorted(filenames): if filename.endswith(".hy"): importlib.import_module( dirpath.replace("/", ".") + "." + filename[:-len(".hy")])