From 3f7b7d0aa1eaa5314e528ac0821587298acb78fa Mon Sep 17 00:00:00 2001 From: Matthew Einhorn Date: Wed, 28 Jan 2015 14:45:24 -0500 Subject: [PATCH] Add both src and build paths to setup.py. --- setup.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/setup.py b/setup.py index a7e24b8dc..1fa314468 100644 --- a/setup.py +++ b/setup.py @@ -131,7 +131,7 @@ if not have_cython: # Setup classes # the build path where kivy is being compiled -build_path = dirname(__file__) +src_path = build_path = dirname(__file__) class KivyBuildExt(build_ext): @@ -146,9 +146,9 @@ class KivyBuildExt(build_ext): def build_extensions(self): # build files - config_h_fn = expand('graphics', 'config.h') - config_pxi_fn = expand('graphics', 'config.pxi') - config_py_fn = expand('setupconfig.py') + config_h_fn = ('graphics', 'config.h') + config_pxi_fn = ('graphics', 'config.pxi') + config_py_fn = ('setupconfig.py', ) # generate headers config_h = '// Autogenerated file for Kivy C configuration\n' @@ -175,8 +175,12 @@ class KivyBuildExt(build_ext): for fn, content in ( (config_h_fn, config_h), (config_pxi_fn, config_pxi), (config_py_fn, config_py)): - if self.update_if_changed(fn, content): - print('Updated {}'.format(fn)) + build_fn = expand(build_path, *fn) + if self.update_if_changed(build_fn, content): + print('Updated {}'.format(build_fn)) + src_fn = expand(src_path, *fn) + if src_fn != build_fn and self.update_if_changed(src_fn, content): + print('Updated {}'.format(src_fn)) c = self.compiler.compiler_type print('Detected compiler is {}'.format(c)) @@ -348,8 +352,8 @@ def get_modulename_from_file(filename): return '.'.join(pyxl) -def expand(*args): - return join(build_path, 'kivy', *args) +def expand(root, *args): + return join(root, 'kivy', *args) class CythonExtension(Extension): @@ -732,7 +736,7 @@ def resolve_dependencies(fn, depends): deps = [] get_dependencies(fn, deps) get_dependencies(fn.replace('.pyx', '.pxd'), deps) - return [expand('graphics', x) for x in deps] + return [expand(src_path, 'graphics', x) for x in deps] def get_extensions_from_sources(sources): @@ -742,9 +746,9 @@ def get_extensions_from_sources(sources): return ext_modules for pyx, flags in sources.items(): is_graphics = pyx.startswith('graphics') - pyx = expand(pyx) - depends = [expand(x) for x in flags.pop('depends', [])] - c_depends = [expand(x) for x in flags.pop('c_depends', [])] + pyx = expand(src_path, pyx) + depends = [expand(src_path, x) for x in flags.pop('depends', [])] + c_depends = [expand(src_path, x) for x in flags.pop('c_depends', [])] if not have_cython: pyx = '%s.c' % pyx[:-4] if is_graphics: