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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
901903e8
Commit
901903e8
authored
Sep 12, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix decorators for 2.3.
parent
92bdeb20
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
Cython/Compiler/Dependencies.py
Cython/Compiler/Dependencies.py
+13
-7
No files found.
Cython/Compiler/Dependencies.py
View file @
901903e8
...
...
@@ -5,7 +5,7 @@ from distutils.extension import Extension
from
Cython
import
Utils
# Unfortunately, Python 2.3 doesn't support decorators.
def
cached_method
(
f
):
cache_name
=
'__%s_cache'
%
f
.
__name__
def
wrapper
(
self
,
*
args
):
...
...
@@ -199,11 +199,12 @@ class DependencyTree(object):
self
.
context
=
context
self
.
_transitive_cache
=
{}
@
cached_method
#
@cached_method
def
parse_dependencies
(
self
,
source_filename
):
return
parse_dependencies
(
source_filename
)
parse_dependencies
=
cached_method
(
parse_dependencies
)
@
cached_method
#
@cached_method
def
cimports_and_externs
(
self
,
filename
):
cimports
,
includes
,
externs
=
self
.
parse_dependencies
(
filename
)[:
3
]
cimports
=
set
(
cimports
)
...
...
@@ -213,22 +214,25 @@ class DependencyTree(object):
cimports
.
update
(
a
)
externs
.
update
(
b
)
return
tuple
(
cimports
),
tuple
(
externs
)
cimports_and_externs
=
cached_method
(
cimports_and_externs
)
def
cimports
(
self
,
filename
):
return
self
.
cimports_and_externs
(
filename
)[
0
]
@
cached_method
#
@cached_method
def
package
(
self
,
filename
):
dir
=
os
.
path
.
dirname
(
filename
)
if
os
.
path
.
exists
(
os
.
path
.
join
(
dir
,
'__init__.py'
)):
return
self
.
package
(
dir
)
+
(
os
.
path
.
basename
(
dir
),)
else
:
return
()
package
=
cached_method
(
package
)
@
cached_method
#
@cached_method
def
fully_qualifeid_name
(
self
,
filename
):
module
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
filename
))[
0
]
return
'.'
.
join
(
self
.
package
(
filename
)
+
(
module
,))
fully_qualifeid_name
=
cached_method
(
fully_qualifeid_name
)
def
find_pxd
(
self
,
module
,
filename
=
None
):
if
module
[
0
]
==
'.'
:
...
...
@@ -240,7 +244,7 @@ class DependencyTree(object):
return
pxd
return
self
.
context
.
find_pxd_file
(
module
,
None
)
@
cached_method
#
@cached_method
def
cimported_files
(
self
,
filename
):
if
filename
[
-
4
:]
==
'.pyx'
and
os
.
path
.
exists
(
filename
[:
-
4
]
+
'.pxd'
):
self_pxd
=
[
filename
[:
-
4
]
+
'.pxd'
]
...
...
@@ -253,6 +257,7 @@ class DependencyTree(object):
print
(
"
\
n
\
t
"
.
join
(
a
))
print
(
"
\
n
\
t
"
.
join
(
b
))
return
tuple
(
self_pxd
+
filter
(
None
,
[
self
.
find_pxd
(
m
,
filename
)
for
m
in
self
.
cimports
(
filename
)]))
cimported_files
=
cached_method
(
cimported_files
)
def
immediate_dependencies
(
self
,
filename
):
all
=
list
(
self
.
cimported_files
(
filename
))
...
...
@@ -260,9 +265,10 @@ class DependencyTree(object):
all
.
append
(
os
.
path
.
normpath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
filename
),
extern
)))
return
tuple
(
all
)
@
cached_method
#
@cached_method
def
timestamp
(
self
,
filename
):
return
os
.
path
.
getmtime
(
filename
)
timestamp
=
cached_method
(
timestamp
)
def
extract_timestamp
(
self
,
filename
):
# TODO: .h files from extern blocks
...
...
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