From a2b46412aab7ac403b9bcf1ca8d1d4c49e7d1031 Mon Sep 17 00:00:00 2001 From: Chichi Lalescu <clalesc1@jhu.edu> Date: Tue, 21 Jul 2015 07:54:57 +0200 Subject: [PATCH] tox fails still trying to figure out where tox puts the header files. --- bfps/NavierStokes.py | 2 ++ bfps/__init__.py | 11 +++++++++++ bfps/code.py | 6 +++--- bfps/test_curl.py | 3 --- setup.py | 2 +- test.py | 1 + 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/bfps/NavierStokes.py b/bfps/NavierStokes.py index d3ec119d..71e93568 100644 --- a/bfps/NavierStokes.py +++ b/bfps/NavierStokes.py @@ -110,6 +110,8 @@ class NavierStokes(bfps.code): ('enstrophy', np.float64), ('vel_max', np.float64), ('renergy', np.float64)]) + if not os.path.isdir(self.work_dir): + os.makedirs(self.work_dir) pickle.dump( self.stats_dtype, open(os.path.join( diff --git a/bfps/__init__.py b/bfps/__init__.py index d1efa817..9e09fc18 100644 --- a/bfps/__init__.py +++ b/bfps/__init__.py @@ -39,6 +39,17 @@ except DistributionNotFound: __version__ = 'git revision ' + subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip() header_dir = './src' lib_dir = './lib' + if not os.path.isfile(os.path.join(header_dir, 'base.hpp')): + tdir = os.path.dirname(os.path.realpath(__file__)) + header_dir = os.path.join(tdir, os.pardir) + if not os.path.isfile(os.path.join(header_dir, 'base.hpp')): + raise ImportError('can not find base.hpp\n' + + 'tdir is {0}\n'.format(tdir) + + 'header_dir is {0}\n'.format(header_dir)) + if os.path.isfile(os.path.join(header_dir, 'libbfps.so')): + lib_dir = tdir + else: + raise ImportError('can not find libbfps.so') else: __version__ = _dist.version diff --git a/bfps/code.py b/bfps/code.py index 01c7dee8..ebeb4041 100644 --- a/bfps/code.py +++ b/bfps/code.py @@ -20,7 +20,7 @@ import bfps -from base import base +from bfps.base import base import subprocess import os import shutil @@ -112,7 +112,7 @@ class code(base): for libname in libraries: command_strings += ['-l' + libname] command_strings += [self.name + '.cpp', '-o', self.name] - print command_strings + print(command_strings) # print sum(command_strings) return subprocess.call(command_strings) def run(self, @@ -122,7 +122,7 @@ class code(base): if self.compile_code(): current_dir = os.getcwd() if not os.path.isdir(self.work_dir): - os.mkdir(self.work_dir) + os.makedirs(self.work_dir) if self.work_dir != './': shutil.copy(self.name, self.work_dir) os.chdir(self.work_dir) diff --git a/bfps/test_curl.py b/bfps/test_curl.py index 5ca59edb..85b07975 100644 --- a/bfps/test_curl.py +++ b/bfps/test_curl.py @@ -257,11 +257,8 @@ def test(opt): c.run(ncpu = opt.ncpu, simname = 'test') k, enespec = c.read_spec() - print k, enespec k, ensspec = c.read_spec(field = 'vorticity') - print k, ensspec k, k2enespec = c.read_spec(field = 'kvelocity') - print k, k2enespec # plot energy and enstrophy fig = plt.figure(figsize = (12, 6)) diff --git a/setup.py b/setup.py index 248ea583..eeb7f755 100644 --- a/setup.py +++ b/setup.py @@ -75,7 +75,7 @@ libbfps = Extension( setup( name = 'bfps', packages = ['bfps'], - install_requires = ['numpy>=1.8'], + install_requires = ['numpy>=1.8', 'matplotlib>=1.3'], ext_modules = [libbfps], data_files = header_list, ######################################################################## diff --git a/test.py b/test.py index 3cfcc541..021bf9da 100755 --- a/test.py +++ b/test.py @@ -29,6 +29,7 @@ import argparse import pickle import os +import bfps from bfps.test import convergence_test from bfps.NavierStokes import test as NStest from bfps.resize import double as resize_test -- GitLab