Skip to content

Commit 6d3b79d

Browse files
committed
Enable json's sort_keys for .habcache files
This makes it so the resulting json data is consistently ordered.
1 parent 311554a commit 6d3b79d

File tree

3 files changed

+310
-310
lines changed

3 files changed

+310
-310
lines changed

hab/cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def save_cache(self, resolver, site_file, version=1):
222222
cache = self.generate_cache(resolver, site_file, version=version)
223223

224224
with cache_file.open("w") as fle:
225-
json.dump(cache, fle, indent=4, cls=utils.HabJsonEncoder)
225+
json.dump(cache, fle, indent=4, sort_keys=True, cls=utils.HabJsonEncoder)
226226
return cache_file
227227

228228
def site_cache_path(self, path):

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def generate_habcached_site_file(config_root, dest):
5050
}
5151

5252
with site_file.open("w") as fle:
53-
json.dump(data, fle, indent=4)
53+
json.dump(data, fle, indent=4, sort_keys=True)
5454

5555
return site_file
5656

0 commit comments

Comments
 (0)