File tree Expand file tree Collapse file tree 4 files changed +5
-5
lines changed
Expand file tree Collapse file tree 4 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ def distro_path_info(self):
9595 cached: Will always be `False`. The path is not stored in a .habcache
9696 file so this data is not cached across processes.
9797 """
98- for path in self .root .glob (self .glob_str ):
98+ for path in sorted ( self .root .glob (self .glob_str ) ):
9999 member_path = path / self .hab_filename
100100 if self .safe :
101101 # Opening archives on cloud based systems is slow, this allows us
Original file line number Diff line number Diff line change @@ -298,7 +298,7 @@ def glob_path(path):
298298 While a `pathlib.Path` can be created with a glob string you won't be able to
299299 resolve the glob into files. This function breaks the path down to its top level
300300 item and calls `Path.glob` on the remaining path. So `Path("/mnt/*/.hab.json")`
301- gets converted into `Path("/mnt").glob("*/.hab.json")`.
301+ gets converted into `sorted( Path("/mnt").glob("*/.hab.json") )`.
302302
303303 The input path will be converted to a `pathlib.Path` object for this operation.
304304
@@ -307,7 +307,7 @@ def glob_path(path):
307307 # Strip the path into its parts removing the root of absolute paths.
308308 parts = path .parts [1 :]
309309 # From the root run a glob search on all parts of the glob string
310- return Path (path .parts [0 ]).glob (str (Path (* parts )))
310+ return sorted ( Path (path .parts [0 ]).glob (str (Path (* parts ) )))
311311
312312
313313class HabJsonEncoder (_json .JSONEncoder ):
Original file line number Diff line number Diff line change 66 - pattern : json.dumps(..., sort_keys=True, ...)
77 - pattern : json.dump(..., sort_keys=True, ...)
88 message : Do not use sort_keys in json, hab relies on preserving the original
9- defined order.
9+ defined order. You will need to sort glob calls for consistency.
1010 languages : [python]
1111 severity : ERROR
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ def __post_init__(self) -> None:
3838 @classmethod
3939 def from_glob (cls , path , glob_str = "*.json" ):
4040 ret = []
41- for filename in path .glob (glob_str ):
41+ for filename in sorted ( path .glob (glob_str ) ):
4242 ret .append (cls (filename ))
4343 return ret
4444
You can’t perform that action at this time.
0 commit comments