Author: malthe Branch: tmpdir-from-environ Changeset: r1562:a9fa3e1d222d Date: 2014-09-02 14:07 +0200 http://bitbucket.org/cffi/cffi/changeset/a9fa3e1d222d/
Log: Add support for 'CFFI_TMPDIR' environment variable If set, the value is used as the 'tmpdir' instead of the caller directory's '__pycache__'. This allows correct run-time operation when the package source is read-only. diff --git a/cffi/verifier.py b/cffi/verifier.py --- a/cffi/verifier.py +++ b/cffi/verifier.py @@ -42,7 +42,7 @@ modulename = '_cffi_%s_%s%s%s' % (tag, self._vengine._class_key, k1, k2) suffix = _get_so_suffixes()[0] - self.tmpdir = tmpdir or _caller_dir_pycache() + self.tmpdir = tmpdir or os.environ.get('CFFI_TMPDIR') or _caller_dir_pycache() self.sourcefilename = os.path.join(self.tmpdir, modulename + '.c') self.modulefilename = os.path.join(self.tmpdir, modulename + suffix) self.ext_package = ext_package diff --git a/doc/source/index.rst b/doc/source/index.rst --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -381,7 +381,10 @@ Alternatively, you can just completely remove the ``__pycache__`` directory. - +An alternative cache directory can be given as the ``tmpdir`` argument +to ``verify()``, via the environment variable ``CFFI_TMPDIR``, or by +calling ``cffi.verifier.set_tmpdir(path)`` prior to calling +``verify``. ======================================================= _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit