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
Kirill Smelkov
cython
Commits
be6ee9cb
Commit
be6ee9cb
authored
Jul 08, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid monkey-patching into the stdlib
parent
d1d120e4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
Cython/Build/Dependencies.py
Cython/Build/Dependencies.py
+8
-8
No files found.
Cython/Build/Dependencies.py
View file @
be6ee9cb
...
@@ -21,7 +21,7 @@ from Cython import Utils
...
@@ -21,7 +21,7 @@ from Cython import Utils
from
Cython.Utils
import
cached_function
,
cached_method
,
path_exists
from
Cython.Utils
import
cached_function
,
cached_method
,
path_exists
from
Cython.Compiler.Main
import
Context
,
CompilationOptions
,
default_options
from
Cython.Compiler.Main
import
Context
,
CompilationOptions
,
default_options
os
.
path
.
join
=
cached_function
(
os
.
path
.
join
)
join_path
=
cached_function
(
os
.
path
.
join
)
if
sys
.
version_info
[
0
]
<
3
:
if
sys
.
version_info
[
0
]
<
3
:
# stupid Py2 distutils enforces str type in list of sources
# stupid Py2 distutils enforces str type in list of sources
...
@@ -43,11 +43,11 @@ def extended_iglob(pattern):
...
@@ -43,11 +43,11 @@ def extended_iglob(pattern):
if
first
==
''
:
if
first
==
''
:
first
=
'.'
first
=
'.'
for
root
in
glob
(
first
+
"/"
):
for
root
in
glob
(
first
+
"/"
):
for
path
in
extended_iglob
(
os
.
path
.
join
(
root
,
rest
)):
for
path
in
extended_iglob
(
join_path
(
root
,
rest
)):
if
path
not
in
seen
:
if
path
not
in
seen
:
seen
.
add
(
path
)
seen
.
add
(
path
)
yield
path
yield
path
for
path
in
extended_iglob
(
os
.
path
.
join
(
root
,
'*'
,
'**'
,
rest
)):
for
path
in
extended_iglob
(
join_path
(
root
,
'*'
,
'**'
,
rest
)):
if
path
not
in
seen
:
if
path
not
in
seen
:
seen
.
add
(
path
)
seen
.
add
(
path
)
yield
path
yield
path
...
@@ -284,7 +284,7 @@ def normalize_existing(base_path, rel_paths):
...
@@ -284,7 +284,7 @@ def normalize_existing(base_path, rel_paths):
def
normalize_existing0
(
base_dir
,
rel_paths
):
def
normalize_existing0
(
base_dir
,
rel_paths
):
filtered
=
[]
filtered
=
[]
for
rel
in
rel_paths
:
for
rel
in
rel_paths
:
path
=
os
.
path
.
join
(
base_dir
,
rel
)
path
=
join_path
(
base_dir
,
rel
)
if
os
.
path
.
exists
(
path
):
if
os
.
path
.
exists
(
path
):
filtered
.
append
(
os
.
path
.
normpath
(
path
))
filtered
.
append
(
os
.
path
.
normpath
(
path
))
return
filtered
return
filtered
...
@@ -335,7 +335,7 @@ class DependencyTree(object):
...
@@ -335,7 +335,7 @@ class DependencyTree(object):
# cimports (and other includes) relative to the including file.
# cimports (and other includes) relative to the including file.
all
=
set
()
all
=
set
()
for
include
in
self
.
parse_dependencies
(
filename
)[
1
]:
for
include
in
self
.
parse_dependencies
(
filename
)[
1
]:
include_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
filename
),
include
)
include_path
=
join_path
(
os
.
path
.
dirname
(
filename
),
include
)
if
not
path_exists
(
include_path
):
if
not
path_exists
(
include_path
):
include_path
=
self
.
context
.
find_include_file
(
include
,
None
)
include_path
=
self
.
context
.
find_include_file
(
include
,
None
)
if
include_path
:
if
include_path
:
...
@@ -364,7 +364,7 @@ class DependencyTree(object):
...
@@ -364,7 +364,7 @@ class DependencyTree(object):
@
cached_method
@
cached_method
def
package
(
self
,
filename
):
def
package
(
self
,
filename
):
dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
str
(
filename
)))
dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
str
(
filename
)))
if
dir
!=
filename
and
path_exists
(
os
.
path
.
join
(
dir
,
'__init__.py'
)):
if
dir
!=
filename
and
path_exists
(
join_path
(
dir
,
'__init__.py'
)):
return
self
.
package
(
dir
)
+
(
os
.
path
.
basename
(
dir
),)
return
self
.
package
(
dir
)
+
(
os
.
path
.
basename
(
dir
),)
else
:
else
:
return
()
return
()
...
@@ -646,7 +646,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None):
...
@@ -646,7 +646,7 @@ def cythonize_one(pyx_file, c_file, fingerprint, quiet, options=None):
raise
raise
# 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
=
os
.
path
.
join
(
fingerprint_file
=
join_path
(
options
.
cache
,
"%s-%s.gz"
%
(
os
.
path
.
basename
(
c_file
),
fingerprint
))
options
.
cache
,
"%s-%s.gz"
%
(
os
.
path
.
basename
(
c_file
),
fingerprint
))
if
os
.
path
.
exists
(
fingerprint_file
):
if
os
.
path
.
exists
(
fingerprint_file
):
if
not
quiet
:
if
not
quiet
:
...
@@ -705,7 +705,7 @@ def cleanup_cache(cache, target_size, ratio=.85):
...
@@ -705,7 +705,7 @@ def cleanup_cache(cache, target_size, ratio=.85):
total_size
=
0
total_size
=
0
all
=
[]
all
=
[]
for
file
in
os
.
listdir
(
cache
):
for
file
in
os
.
listdir
(
cache
):
path
=
os
.
path
.
join
(
cache
,
file
)
path
=
join_path
(
cache
,
file
)
s
=
os
.
stat
(
path
)
s
=
os
.
stat
(
path
)
total_size
+=
s
.
st_size
total_size
+=
s
.
st_size
all
.
append
((
s
.
st_atime
,
s
.
st_size
,
path
))
all
.
append
((
s
.
st_atime
,
s
.
st_size
,
path
))
...
...
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