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
2cde741b
Commit
2cde741b
authored
Sep 12, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Utility methods for unpacking a source tree from a single file.
parent
ff954f31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
Cython/TestUtils.py
Cython/TestUtils.py
+18
-1
No files found.
Cython/TestUtils.py
View file @
2cde741b
...
...
@@ -7,7 +7,8 @@ from Cython.Compiler.Visitor import TreeVisitor, VisitorTransform
from
Cython.Compiler
import
TreePath
import
unittest
import
sys
import
os
,
sys
import
tempfile
class
NodeTypeWriter
(
TreeVisitor
):
def
__init__
(
self
):
...
...
@@ -166,3 +167,19 @@ class TreeAssertVisitor(VisitorTransform):
return
node
visit_Node
=
VisitorTransform
.
recurse_to_children
def
unpack_source_tree
(
tree_file
):
dir
=
tempfile
.
mkdtemp
()
cur_file
=
None
for
line
in
open
(
tree_file
).
readlines
():
if
line
[:
5
]
==
'#####'
:
filename
=
line
.
strip
().
strip
(
'#'
).
strip
()
path
=
os
.
path
.
join
(
dir
,
filename
)
print
os
.
path
.
dirname
(
path
)
if
not
os
.
path
.
exists
(
os
.
path
.
dirname
(
path
)):
print
" ...creating"
os
.
makedirs
(
os
.
path
.
dirname
(
path
))
cur_file
=
open
(
path
,
'w'
)
elif
cur_file
is
not
None
:
cur_file
.
write
(
line
)
return
dir
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