From 1c247ef5576afe401be02e08b974824263f3d61b Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Thu, 5 Mar 2015 15:40:23 +0100 Subject: Avoid Python recompilation during installation --- python/builder.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'python') diff --git a/python/builder.py b/python/builder.py index ddca795..cfdb7d1 100644 --- a/python/builder.py +++ b/python/builder.py @@ -41,9 +41,22 @@ try: usecuda=True except KeyError: pass -cfg = open('astra/config.pxi','w') -cfg.write('DEF HAVE_CUDA=' + str(usecuda) + "\n") -cfg.close() + +cfgToWrite = 'DEF HAVE_CUDA=' + str(usecuda) + "\n" +cfgHasToBeUpdated = True +try: + cfg = open('astra/config.pxi','r') + cfgIn = cfg.read() + cfg.close() + if cfgIn==cfgToWrite: + cfgHasToBeUpdated = False +except IOError: + pass + +if cfgHasToBeUpdated: + cfg = open('astra/config.pxi','w') + cfg.write(cfgToWrite) + cfg.close() cmdclass = { } ext_modules = [ ] -- cgit v1.2.3