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
2997c9d4
Commit
2997c9d4
authored
Jul 28, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid hard dependency on gzip module
parent
1b05e8bd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
Cython/Build/Dependencies.py
Cython/Build/Dependencies.py
+10
-4
No files found.
Cython/Build/Dependencies.py
View file @
2997c9d4
...
@@ -3,7 +3,13 @@ from Cython import __version__
...
@@ -3,7 +3,13 @@ from Cython import __version__
from
glob
import
glob
from
glob
import
glob
import
re
,
os
,
sys
import
re
,
os
,
sys
import
gzip
try
:
import
gzip
gzip_open
=
gz
.
open
gzip_ext
=
'.gz'
except
ImportError
:
gzip_open
=
open
gzip_ext
=
''
import
shutil
import
shutil
import
subprocess
import
subprocess
...
@@ -647,12 +653,12 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None):
...
@@ -647,12 +653,12 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None):
# Cython-generated c files are highly compressible.
# Cython-generated c files are highly compressible.
# (E.g. a compression ratio of about 10 for Sage).
# (E.g. a compression ratio of about 10 for Sage).
fingerprint_file
=
join_path
(
fingerprint_file
=
join_path
(
options
.
cache
,
"%s-%s
.gz"
%
(
os
.
path
.
basename
(
c_file
),
fingerprin
t
))
options
.
cache
,
"%s-%s
%s"
%
(
os
.
path
.
basename
(
c_file
),
fingerprint
,
gzip_ex
t
))
if
os
.
path
.
exists
(
fingerprint_file
):
if
os
.
path
.
exists
(
fingerprint_file
):
if
not
quiet
:
if
not
quiet
:
print
(
"Found compiled %s in cache"
%
pyx_file
)
print
(
"Found compiled %s in cache"
%
pyx_file
)
os
.
utime
(
fingerprint_file
,
None
)
os
.
utime
(
fingerprint_file
,
None
)
g
=
gzip
.
open
(
fingerprint_file
)
g
=
gzip
_open
(
fingerprint_file
,
'rb'
)
try
:
try
:
f
=
open
(
c_file
,
'wb'
)
f
=
open
(
c_file
,
'wb'
)
try
:
try
:
...
@@ -681,7 +687,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None):
...
@@ -681,7 +687,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None):
if
fingerprint
:
if
fingerprint
:
f
=
open
(
c_file
,
'rb'
)
f
=
open
(
c_file
,
'rb'
)
try
:
try
:
g
=
gzip
.
open
(
fingerprint_file
,
'wb'
)
g
=
gzip
_
open
(
fingerprint_file
,
'wb'
)
try
:
try
:
shutil
.
copyfileobj
(
f
,
g
)
shutil
.
copyfileobj
(
f
,
g
)
finally
:
finally
:
...
...
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