[Cython] [PATCH 1/2] Move ~/.pyxbld to $XDG_CACHE_HOME/pyxbld
--- 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 ___ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel
[Cython] [PATCH 2/2] Make the Cython cache directory fallback to ~/.cache/cython if $XDG_CACHE_HOME isn’t set
--- Cython/Utils.py | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Cython/Utils.py b/Cython/Utils.py index 22f6db7..563989f 100644 --- a/Cython/Utils.py +++ b/Cython/Utils.py @@ -327,7 +327,8 @@ def get_cython_cache_dir(): 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 +3. ~/.cache/cython +4. ~/.cython """ if 'CYTHON_CACHE_DIR' in os.environ: @@ -338,8 +339,8 @@ def get_cython_cache_dir(): if sys.platform == 'darwin': parent = os.path.expanduser('~/Library/Caches') else: -# this could fallback on ~/.cache -parent = os.environ.get('XDG_CACHE_HOME') +parent = os.environ.get('XDG_CACHE_HOME', +os.path.join(os.path.expanduser('~'), '.cache')) if parent and os.path.isdir(parent): return os.path.join(parent, 'cython') -- 2.3.5 ___ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel
Re: [Cython] [PATCH 1/2] Move ~/.pyxbld to $XDG_CACHE_HOME/pyxbld
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