[Cython] [PATCH 1/2] Move ~/.pyxbld to $XDG_CACHE_HOME/pyxbld

Emmanuel Gil Peyrot linkmauve at linkmauve.fr
Wed Apr 29 20:11:28 CEST 2015


---
 pyximport/pyximport.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/pyximport/pyximport.py b/pyximport/pyximport.py
index 4fd7fe9..710c5eb 100644
--- a/pyximport/pyximport.py
+++ b/pyximport/pyximport.py
@@ -466,9 +466,10 @@ def install(pyximport=True, pyimport=False, build_dir=None, build_in_temp=True,
     will not work for most .py files, and will therefore only slow
     down your imports.  Use at your own risk.
 
-    By default, compiled modules will end up in a ``.pyxbld``
-    directory in the user's home directory.  Passing a different path
-    as ``build_dir`` will override this.
+    By default, compiled modules will end up in a ``pyxbld`` directory
+    in the directory pointed by the ``XDG_CACHE_HOME`` environment
+    variable, or in ``~/.cache/pyxbld`` if ``XDG_CACHE_HOME`` isn’t
+    set.  Passing a different path as ``build_dir`` will override this.
 
     ``build_in_temp=False`` will produce the C files locally. Working
     with complex dependencies and debugging becomes more easy. This
@@ -501,8 +502,9 @@ def install(pyximport=True, pyimport=False, build_dir=None, build_in_temp=True,
     runtime for .py files and Py2 for .pyx files.
     """
     if not build_dir:
-        build_dir = os.path.join(os.path.expanduser('~'), '.pyxbld')
-        
+        build_dir = os.path.join(os.environ.get('XDG_CACHE_HOME',
+            os.path.join(os.path.expanduser('~'), '.cache')), 'pyxbld')
+
     global pyxargs
     pyxargs = PyxArgs()  #$pycheck_no
     pyxargs.build_dir = build_dir
-- 
2.3.5



More information about the cython-devel mailing list