Skip to content
Permalink
Browse files Browse the repository at this point in the history
setuptools/dist: Fix reproducibility issue by sorting globbing
globbing uses os.listdir() which returns order on disk which is unsorted.
Ultimately this leads to random ordering of License-File entries in PKG-INFO
and means the resulting output isn't deterministic.

Adding a sort fixes that. Switch to glob instead ot iglob since sorted()
removes the benefit of an iterator.

#2691

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
  • Loading branch information
rpurdie committed May 31, 2021
1 parent 2234e88 commit 5a0404f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions setuptools/dist.py
Expand Up @@ -15,7 +15,7 @@
from distutils.util import strtobool
from distutils.debug import DEBUG
from distutils.fancy_getopt import translate_longopt
from glob import iglob
from glob import glob
import itertools
import textwrap
from typing import List, Optional, TYPE_CHECKING
Expand Down Expand Up @@ -603,7 +603,7 @@ def _expand_patterns(patterns):
return (
path
for pattern in patterns
for path in iglob(pattern)
for path in sorted(glob(pattern))
if not path.endswith('~')
and os.path.isfile(path)
)
Expand Down

0 comments on commit 5a0404f

Please sign in to comment.