From ad535ac2bd90760a5cb2173de6a3a6c76f350565 Mon Sep 17 00:00:00 2001 From: Evgeni Burovski Date: Tue, 16 Feb 2016 07:10:13 +0000 Subject: [PATCH] MAINT: address review comments --- skimage/_build.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/skimage/_build.py b/skimage/_build.py index c5041340..a091dd1e 100644 --- a/skimage/_build.py +++ b/skimage/_build.py @@ -85,10 +85,12 @@ def process_tempita_pyx(fromfile): except ImportError: raise Exception('Building requires Tempita: ' 'pip install --user Tempita') - from_filename = tempita.Template.from_filename - template = from_filename(fromfile, encoding=sys.getdefaultencoding()) + template = tempita.Template.from_filename(fromfile, + encoding=sys.getdefaultencoding()) pyxcontent = template.substitute() - assert fromfile.endswith('.pyx.in') - pyxfile = fromfile[:-len('.pyx.in')] + '.pyx' + if not fromfile.endswith('.pyx.in'): + raise ValueError("Unexpected extension of %s." % fromfile) + + pyxfile = os.path.splitext(fromfile)[0] + '.pyx' with open(pyxfile, "w") as f: f.write(pyxcontent)