From fdb34881be1f6061450bc6136ec3280985726aee Mon Sep 17 00:00:00 2001 From: ipelupessy Date: Fri, 6 Jul 2018 15:21:49 +0200 Subject: [PATCH] fix copy of libs (no src files) and fix hash test for python 3 --- lib/simple_hash/test.py | 14 +++++++------- support/setup_codes.py | 20 +++++++++++--------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/simple_hash/test.py b/lib/simple_hash/test.py index c9ffbd57d1..048737fbb6 100644 --- a/lib/simple_hash/test.py +++ b/lib/simple_hash/test.py @@ -4,27 +4,27 @@ class HashTableWrapper: def __init__(self, pathToExe): - self.p = subprocess.Popen(pathToExe, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + self.p = subprocess.Popen(pathToExe, stdin=subprocess.PIPE, stdout=subprocess.PIPE,bufsize=0) # self.p.stdin = DebugPrintFilter(self.p.stdin) def __setitem__(self, key, value): # print 'insert %d %d' % (key, value) - self.p.stdin.write('insert %d %d\n' % (key, value)) + self.p.stdin.write(b'insert %d %d\n' % (key, value)) def __getitem__(self, key): # print 'lookup %d' % key - self.p.stdin.write('lookup %d\n' % key) + self.p.stdin.write(b'lookup %d\n' % key) return eval(self.p.stdout.readline()) def increment(self, key): # print 'increment %d' % key - self.p.stdin.write('increment %d\n' % key) + self.p.stdin.write(b'increment %d\n' % key) def __delitem__(self, key): # print 'delete %d' % key - self.p.stdin.write('delete %d\n' % key) + self.p.stdin.write(b'delete %d\n' % key) def clear(self): # print "clear" - self.p.stdin.write('clear\n') + self.p.stdin.write(b'clear\n') def compact(self): # print "compact" - self.p.stdin.write('compact\n') + self.p.stdin.write(b'compact\n') def run(self, test, *args): r = test(self, *args) self.p.stdin.close() diff --git a/support/setup_codes.py b/support/setup_codes.py index e0777144dd..05786e3f8d 100644 --- a/support/setup_codes.py +++ b/support/setup_codes.py @@ -19,6 +19,7 @@ from distutils import sysconfig from distutils.core import Command from distutils.dep_util import newer +from distutils.dir_util import create_tree from distutils.util import convert_path from distutils import log from distutils import spawn @@ -108,8 +109,6 @@ def finalize_options (self): self.lib_dir=os.path.join(self.build_temp, 'lib') def run(self): - print (self.lib_dir) - data_dir = os.path.join(self.install_data,'share','amuse') if not self.root is None: data_dir = os.path.relpath(data_dir,self.root) @@ -117,15 +116,18 @@ def run(self): else: data_dir = os.path.abspath(data_dir) - print (data_dir) - - # to do copy only: + # copy only: # '*.h', '*.a', '*.mod', '*.inc', '*.so', '*.dylib' - self.copy_tree( - self.lib_dir, - os.path.join(data_dir,'lib') - ) + files=[os.path.join(dp, f) for dp, dn, fn in os.walk(self.lib_dir) for f in fn] + ext=['.h', '.a', '.mod', '.inc', '.so', '.dylib'] + files=[f for f in files if (os.path.splitext(f)[1] in ext)] + files=[os.path.relpath(f,self.lib_dir) for f in files] + create_tree(os.path.join(data_dir,'lib'), files) + for f in files: + src=os.path.join(self.lib_dir,f) + target=os.path.join(data_dir,'lib', f) + self.copy_file(src,target) class GenerateInstallIni(Command): user_options = (