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
468929dc
Commit
468929dc
authored
Mar 06, 2014
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore support for Python 2.6 in bootstrap script. Fixes #157.
parent
2610eb29
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
CHANGES.txt
CHANGES.txt
+7
-0
ez_setup.py
ez_setup.py
+14
-1
No files found.
CHANGES.txt
View file @
468929dc
...
...
@@ -2,6 +2,13 @@
CHANGES
=======
-----
3.0.1
-----
* Issue #157: Restore support for Python 2.6 in bootstrap script where
``zipfile.ZipFile`` does not yet have support for context managers.
---
3.0
---
...
...
ez_setup.py
View file @
468929dc
...
...
@@ -64,6 +64,19 @@ def _build_egg(egg, archive_filename, to_dir):
raise
IOError
(
'Could not build the egg.'
)
def
get_zip_class
():
"""
Supplement ZipFile class to support context manager for Python 2.6
"""
class
ContextualZipFile
(
zipfile
.
ZipFile
):
def
__enter__
(
self
):
return
self
def
__exit__
(
self
,
type
,
value
,
traceback
):
self
.
close
return
zipfile
.
Zipfile
if
hasattr
(
zipfile
.
ZipFile
,
'__exit__'
)
else
\
ContextualZipFile
@
contextlib
.
contextmanager
def
archive_context
(
filename
):
# extracting the archive
...
...
@@ -72,7 +85,7 @@ def archive_context(filename):
old_wd
=
os
.
getcwd
()
try
:
os
.
chdir
(
tmpdir
)
with
zipfile
.
ZipFile
(
filename
)
as
archive
:
with
get_zip_class
()
(
filename
)
as
archive
:
archive
.
extractall
()
# going in the directory
...
...
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