From b6de889775a292363446fe147c477d88289d4ff2 Mon Sep 17 00:00:00 2001 From: Pey Lian Lim <2090236+pllim@users.noreply.github.com> Date: Wed, 20 Mar 2019 11:51:34 -0400 Subject: [PATCH 1/3] MNT: Always compile Cython at build time --- MANIFEST.in | 2 +- setup.py | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index a24056f..73e95fd 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,6 +3,6 @@ include LICENSE_Python.txt include README.rst include python25.pxd include timers.h -include _line_profiler.c +exclude _line_profiler.c include unset_trace.h recursive-include tests *.py diff --git a/setup.py b/setup.py index edc096c..9190690 100755 --- a/setup.py +++ b/setup.py @@ -1,28 +1,18 @@ -import os import sys -# Monkeypatch distutils. -import setuptools - import distutils.errors from distutils.core import setup from distutils.extension import Extension -from distutils.log import warn try: from Cython.Distutils import build_ext cmdclass = dict(build_ext=build_ext) line_profiler_source = '_line_profiler.pyx' except ImportError: - cmdclass = {} - line_profiler_source = '_line_profiler.c' - if not os.path.exists(line_profiler_source): - raise distutils.errors.DistutilsError("""\ + raise distutils.errors.DistutilsError("""\ You need Cython to build the line_profiler from a git checkout, or alternatively use a release tarball from PyPI to build it without Cython.""") - else: - warn("Could not import Cython. " - "Using the available pre-generated C file.") + long_description = """\ line_profiler will profile the time individual lines of code take to execute. @@ -78,6 +68,9 @@ 'kernprof=kernprof:main', ], }, + setup_requires = [ + 'cython', + ], install_requires = [ 'IPython>=0.13', ], From 3b4350880cd4b829a88acb0be359df4a1ce30cd1 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 20 Mar 2019 12:24:06 -0400 Subject: [PATCH 2/3] MNT: Add pyproject.toml --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..3358992 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + "setuptools", + "wheel", + "cython" +] From e3cea6a4ea7a7d7ddc05d2cc7b905f6020591083 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Wed, 20 Mar 2019 12:44:37 -0400 Subject: [PATCH 3/3] Add the monkeypatching back in setup --- setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.py b/setup.py index 9190690..23fb7f3 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,8 @@ import sys +# Monkeypatch distutils. +import setuptools + import distutils.errors from distutils.core import setup from distutils.extension import Extension