Skip to content

Commit 7b1de9d

Browse files
committed
ENH: tweak setup.py when building from a source checkout without cython.
1 parent d0d0eb7 commit 7b1de9d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

setup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import os.path
12

3+
import distutils.errors
24
from distutils.core import setup
35
from distutils.extension import Extension
46
from distutils.log import warn
@@ -8,9 +10,14 @@
810
cmdclass = dict(build_ext=build_ext)
911
line_profiler_source = '_line_profiler.pyx'
1012
except ImportError, e:
11-
warn("Could not import Cython. Using pre-generated C file if available.")
1213
cmdclass = {}
1314
line_profiler_source = '_line_profiler.c'
15+
if not os.path.exists(line_profiler_source):
16+
raise distutils.errors.DistutilsError("""\
17+
You need cython to build the line_profiler from a mercurial checkout, or
18+
alternatively use a release tarball from PyPI to build it without cython.""")
19+
else:
20+
warn("Could not import Cython. Using pre-generated C file if available.")
1421

1522
long_description = """\
1623
line_profiler will profile the time individual lines of code take to execute.

0 commit comments

Comments
 (0)