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.
This commit is contained in:
Kodi Arfer 2017-04-24 07:54:15 -07:00 committed by Ryan Gonzalez
parent 21cec4b64a
commit a9cfe25068

View File

@ -53,8 +53,8 @@ class Install(install):
def run(self): def run(self):
# Import each Hy module to ensure it's compiled. # Import each Hy module to ensure it's compiled.
import os, importlib import os, importlib
for dirpath, _, filenames in os.walk("hy"): for dirpath, _, filenames in sorted(os.walk("hy")):
for filename in filenames: for filename in sorted(filenames):
if filename.endswith(".hy"): if filename.endswith(".hy"):
importlib.import_module( importlib.import_module(
dirpath.replace("/", ".") + "." + filename[:-len(".hy")]) dirpath.replace("/", ".") + "." + filename[:-len(".hy")])