Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
f002e31c
Commit
f002e31c
authored
May 04, 2018
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use contextlib.closing for 2.6.
parent
14c1d8df
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
Cython/Build/Dependencies.py
Cython/Build/Dependencies.py
+10
-8
No files found.
Cython/Build/Dependencies.py
View file @
f002e31c
...
...
@@ -3,11 +3,12 @@ from __future__ import absolute_import, print_function
import
cython
from
..
import
__version__
import
collections
import
contextlib
import
hashlib
import
os
import
shutil
import
hashlib
import
subprocess
import
collections
import
re
,
sys
,
time
from
glob
import
iglob
from
io
import
open
as
io_open
...
...
@@ -1117,13 +1118,13 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None,
print
(
"%sFound compiled %s in cache"
%
(
progress
,
pyx_file
))
if
os
.
path
.
exists
(
gz_fingerprint_file
):
os
.
utime
(
gz_fingerprint_file
,
None
)
with
gzip_open
(
gz_fingerprint_file
,
'rb'
)
as
g
:
with
open
(
c_file
,
'wb'
)
as
f
:
with
contextlib
.
closing
(
gzip_open
(
gz_fingerprint_file
,
'rb'
)
)
as
g
:
with
contextlib
.
closing
(
open
(
c_file
,
'wb'
)
)
as
f
:
shutil
.
copyfileobj
(
g
,
f
)
else
:
os
.
utime
(
zip_fingerprint_file
,
None
)
dirname
=
os
.
path
.
dirname
(
c_file
)
with
zipfile
.
ZipFile
(
zip_fingerprint_file
)
as
z
:
with
contextlib
.
closing
(
zipfile
.
ZipFile
(
zip_fingerprint_file
)
)
as
z
:
for
artifact
in
z
.
namelist
():
z
.
extract
(
artifact
,
os
.
path
.
join
(
dirname
,
artifact
))
return
...
...
@@ -1162,12 +1163,13 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None,
for
attr
in
(
'c_file'
,
'h_file'
,
'api_file'
,
'i_file'
)]))
if
len
(
artifacts
)
==
1
:
fingerprint_file
=
gz_fingerprint_file
with
open
(
c_file
,
'rb'
)
as
f
:
with
gzip_open
(
fingerprint_file
+
'.tmp'
,
'wb'
)
as
g
:
with
contextlib
.
closing
(
open
(
c_file
,
'rb'
)
)
as
f
:
with
contextlib
.
closing
(
gzip_open
(
fingerprint_file
+
'.tmp'
,
'wb'
)
)
as
g
:
shutil
.
copyfileobj
(
f
,
g
)
else
:
fingerprint_file
=
zip_fingerprint_file
with
zipfile
.
ZipFile
(
fingerprint_file
+
'.tmp'
,
'w'
,
zipfile_compression_mode
)
as
zip
:
with
contextlib
.
closing
(
zipfile
.
ZipFile
(
fingerprint_file
+
'.tmp'
,
'w'
,
zipfile_compression_mode
))
as
zip
:
for
artifact
in
artifacts
:
zip
.
write
(
artifact
,
os
.
path
.
basename
(
artifact
))
os
.
rename
(
fingerprint_file
+
'.tmp'
,
fingerprint_file
)
...
...
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