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
Boxiang Sun
cython
Commits
9ec01981
Commit
9ec01981
authored
Dec 02, 2011
by
Lisandro Dalcin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix loading of utility code from ZIP file
parent
2675a89c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
Cython/Compiler/Code.py
Cython/Compiler/Code.py
+15
-1
No files found.
Cython/Compiler/Code.py
View file @
9ec01981
...
...
@@ -167,8 +167,22 @@ class UtilityCodeBase(object):
if
from_file
is
None
:
utility_dir
=
get_utility_dir
()
prefix
=
util_code_name
+
'.'
try
:
listing
=
os
.
listdir
(
utility_dir
)
except
OSError
:
# XXX the code below assumes as 'zipimport.zipimporter' instance
# XXX should be easy to generalize, but too lazy right now to write it
import
zipfile
global
__loader__
loader
=
__loader__
archive
=
loader
.
archive
fileobj
=
zipfile
.
ZipFile
(
archive
)
listing
=
[
os
.
path
.
basename
(
name
)
for
name
in
fileobj
.
namelist
()
if
os
.
path
.
join
(
archive
,
name
).
startswith
(
utility_dir
)]
fileobj
.
close
()
files
=
[
os
.
path
.
join
(
utility_dir
,
filename
)
for
filename
in
os
.
listdir
(
utility_dir
)
for
filename
in
listing
if
filename
.
startswith
(
prefix
)
]
if
not
files
:
raise
ValueError
(
"No match found for utility code "
+
util_code_name
)
...
...
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