diff --git a/CONTRIBUTE.rst b/CONTRIBUTE.rst index 978d5fd3c4149a89cf5b6ba0a6d7a8d0237a7daf..8063c8b230b86ed2253fad9bcf26b2b9eb953b89 100644 --- a/CONTRIBUTE.rst +++ b/CONTRIBUTE.rst @@ -75,10 +75,13 @@ A useful trick for working on the source code is to build in-place so that there is no need to re-install after each change. This can be done with the following command :: - python setup.py build_ext -i + python setup.py build_ext -i --cython The ``kwant`` subdirectory of the source distribution will be thus turned into a proper Python package that can be imported. To be able to import Kwant from within Python, one can either work in the root directory of the distribution (where the subdirectory ``kwant`` is located), or make a (symbolic) link from somewhere in the Python search path to the the package subdirectory. + +The option ``--cython`` enables the translation of .pyx files into .c files. +It is only needed if any .pyx files have been modified. diff --git a/setup.py b/setup.py index c9dba0e6852f263c98fe5e8a2dd314c8261da57a..ba679701659b2ff224a2c993fefca13421650d0d 100755 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ MANIFEST_IN_FILE = 'MANIFEST.in' README_END_BEFORE = 'See also in this directory:' STATIC_VERSION_PATH = ('kwant', '_kwant_version.py') REQUIRED_CYTHON_VERSION = (0, 22) -NO_CYTHON_OPTION = '--no-cython' +CYTHON_OPTION = '--cython' TUT_DIR = 'tutorial' TUT_GLOB = 'doc/source/tutorial/*.py' TUT_HIDDEN_PREFIX = '#HIDDEN' @@ -59,10 +59,10 @@ version = _common.version version_is_from_git = _common.version_is_from_git try: - sys.argv.remove(NO_CYTHON_OPTION) - use_cython = False -except ValueError: + sys.argv.remove(CYTHON_OPTION) use_cython = True +except ValueError: + use_cython = False if use_cython: try: @@ -424,7 +424,7 @@ def ext_modules(extensions): if problematic_files: problematic_files = ", ".join(problematic_files) msg = ("Some Cython source files are newer than files that should have\n" - " been derived from them, but {}.\n" + "been derived from them, but {}.\n" "\n" "Affected files: {}") if use_cython: @@ -438,8 +438,11 @@ def ext_modules(extensions): complain_cython_unavailable() exit(1) else: - reason = "the option --no-cython has been given" - print(banner(" Warning "), msg.format(reason, problematic_files), + reason = "the option {} has not been given".format(CYTHON_OPTION) + dontworry = ('(Do not worry about this if you are building Kwant\n' + 'from unmodified sources, e.g. with "pip install".)\n') + print(banner(" Caution "), dontworry, + msg.format(reason, problematic_files), banner(), sep='\n', file=sys.stderr) return result