summaryrefslogtreecommitdiff
path: root/setuptools/command
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2017-09-03 13:39:20 -0400
committerGitHub <noreply@github.com>2017-09-03 13:39:20 -0400
commit7944b2b156cc49e6aeec83a8179bc4ce23496c82 (patch)
treeccfa29eeb92e4afb2368c4a5eca9e97e744b18d9 /setuptools/command
parent500bb9a161e810523c48825491b853c5fbe595cc (diff)
parentf7e27cc04a9db9952dd1cdeee7e9b0a8b779f0d0 (diff)
downloadpython-setuptools-git-7944b2b156cc49e6aeec83a8179bc4ce23496c82.tar.gz
Merge branch 'master' into add_markdown_to_possible_readmes
Diffstat (limited to 'setuptools/command')
-rw-r--r--setuptools/command/bdist_egg.py16
-rwxr-xr-xsetuptools/command/egg_info.py4
2 files changed, 16 insertions, 4 deletions
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py
index 8cd9dfef..51755d52 100644
--- a/setuptools/command/bdist_egg.py
+++ b/setuptools/command/bdist_egg.py
@@ -38,6 +38,14 @@ def strip_module(filename):
filename = filename[:-6]
return filename
+def sorted_walk(dir):
+ """Do os.walk in a reproducible way,
+ independent of indeterministic filesystem readdir order
+ """
+ for base, dirs, files in os.walk(dir):
+ dirs.sort()
+ files.sort()
+ yield base, dirs, files
def write_stub(resource, pyfile):
_stub_template = textwrap.dedent("""
@@ -302,7 +310,7 @@ class bdist_egg(Command):
ext_outputs = []
paths = {self.bdist_dir: ''}
- for base, dirs, files in os.walk(self.bdist_dir):
+ for base, dirs, files in sorted_walk(self.bdist_dir):
for filename in files:
if os.path.splitext(filename)[1].lower() in NATIVE_EXTENSIONS:
all_outputs.append(paths[base] + filename)
@@ -329,7 +337,7 @@ NATIVE_EXTENSIONS = dict.fromkeys('.dll .so .dylib .pyd'.split())
def walk_egg(egg_dir):
"""Walk an unpacked egg's contents, skipping the metadata directory"""
- walker = os.walk(egg_dir)
+ walker = sorted_walk(egg_dir)
base, dirs, files = next(walker)
if 'EGG-INFO' in dirs:
dirs.remove('EGG-INFO')
@@ -463,10 +471,10 @@ def make_zipfile(zip_filename, base_dir, verbose=0, dry_run=0, compress=True,
compression = zipfile.ZIP_DEFLATED if compress else zipfile.ZIP_STORED
if not dry_run:
z = zipfile.ZipFile(zip_filename, mode, compression=compression)
- for dirname, dirs, files in os.walk(base_dir):
+ for dirname, dirs, files in sorted_walk(base_dir):
visit(z, dirname, files)
z.close()
else:
- for dirname, dirs, files in os.walk(base_dir):
+ for dirname, dirs, files in sorted_walk(base_dir):
visit(None, dirname, files)
return zip_filename
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 6c00b0b7..a183d15d 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -599,6 +599,10 @@ def write_pkg_info(cmd, basename, filename):
metadata = cmd.distribution.metadata
metadata.version, oldver = cmd.egg_version, metadata.version
metadata.name, oldname = cmd.egg_name, metadata.name
+ metadata.long_description_content_type = getattr(
+ cmd.distribution,
+ 'long_description_content_type'
+ )
try:
# write unescaped data to PKG-INFO, so older pkg_resources
# can still parse it