Actually, I think it’d be better to move the pyxbld directory directly
under the cython cache directory, as it is part of cython itself.

Here is an attached patch updated with this behaviour.

-- 
Emmanuel Gil Peyrot
[PATCH 1/2] Move ~/.pyxbld to $XDG_CACHE_HOME/cython/pyxbld

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

diff --git a/pyximport/pyximport.py b/pyximport/pyximport.py
index 4fd7fe9..abed8e6 100644
--- a/pyximport/pyximport.py
+++ b/pyximport/pyximport.py
@@ -466,9 +466,11 @@ 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 ``cython/pyxbld``
+    directory in the directory pointed by the ``XDG_CACHE_HOME``
+    environment variable, or in ``~/.cache/cython/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 +503,10 @@ 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')),
+            'cython', 'pyxbld')
+
     global pyxargs
     pyxargs = PyxArgs()  #$pycheck_no
     pyxargs.build_dir = build_dir
-- 
2.3.5
_______________________________________________
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel

Reply via email to