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
cae2bcf2
Commit
cae2bcf2
authored
May 31, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #128 from minrk/cythonenv
add CYTHON_CACHE_DIR env
parents
684ecc93
fac2617b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
Cython/Build/Inline.py
Cython/Build/Inline.py
+2
-1
Cython/Utils.py
Cython/Utils.py
+29
-0
No files found.
Cython/Build/Inline.py
View file @
cae2bcf2
...
...
@@ -16,6 +16,7 @@ from Cython.Compiler.ParseTreeTransforms import CythonTransform, SkipDeclaration
from
Cython.Compiler.TreeFragment
import
parse_from_strings
from
Cython.Build.Dependencies
import
strip_string_literals
,
cythonize
,
cached_function
from
Cython.Compiler
import
Pipeline
from
Cython.Utils
import
get_cython_cache_dir
import
cython
as
cython_module
# A utility function to convert user-supplied ASCII strings to unicode.
...
...
@@ -95,7 +96,7 @@ def safe_type(arg, context=None):
def
cython_inline
(
code
,
get_type
=
unsafe_type
,
lib_dir
=
os
.
path
.
expanduser
(
'~/.cython/
inline'
),
lib_dir
=
os
.
path
.
join
(
get_cython_cache_dir
(),
'
inline'
),
cython_include_dirs
=
[
'.'
],
force
=
False
,
quiet
=
False
,
...
...
Cython/Utils.py
View file @
cae2bcf2
...
...
@@ -364,3 +364,32 @@ except NameError:
if
item
:
return
True
return
False
@
cached_function
def
get_cython_cache_dir
():
"""get the cython cache dir
Priority:
1. CYTHON_CACHE_DIR
2. (OS X): ~/Library/Caches/Cython
(posix not OS X): XDG_CACHE_HOME/cython if XDG_CACHE_HOME defined
3. ~/.cython
"""
if
'CYTHON_CACHE_DIR'
in
os
.
environ
:
return
os
.
environ
[
'CYTHON_CACHE_DIR'
]
parent
=
None
if
os
.
name
==
'posix'
:
if
sys
.
platform
==
'darwin'
:
parent
=
os
.
path
.
expanduser
(
'~/Library/Caches'
)
else
:
# this could fallback on ~/.cache
parent
=
os
.
environ
.
get
(
'XDG_CACHE_HOME'
)
if
parent
and
os
.
path
.
isdir
(
parent
):
return
os
.
path
.
join
(
parent
,
'cython'
)
# last fallback: ~/.cython/inline
return
os
.
path
.
expanduser
(
os
.
path
.
join
(
'~'
,
'.cython'
))
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