Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
24f240e7
Commit
24f240e7
authored
Sep 03, 2017
by
Jason R. Coombs
Committed by
GitHub
Sep 03, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1068 from bmwiedemann/sortzip
Sort file lists
parents
b4d58d49
21bffb67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
CHANGES.rst
CHANGES.rst
+6
-0
setuptools/command/bdist_egg.py
setuptools/command/bdist_egg.py
+12
-4
No files found.
CHANGES.rst
View file @
24f240e7
v36
.4.0
-------
*
#
1068
:
Sort
files
and
directories
when
building
eggs
for
deterministic
order
.
v36
.3.0
-------
...
...
setuptools/command/bdist_egg.py
View file @
24f240e7
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment