Skip to content

Commit

Permalink
fix copy of libs (no src files) and fix hash test for python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ipelupessy committed Jul 6, 2018
1 parent 3c41381 commit fdb3488
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
14 changes: 7 additions & 7 deletions lib/simple_hash/test.py
Expand Up @@ -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()
Expand Down
20 changes: 11 additions & 9 deletions support/setup_codes.py
Expand Up @@ -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
Expand Down Expand Up @@ -108,24 +109,25 @@ 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)
data_dir = os.path.join('/',data_dir)
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 = (
Expand Down

0 comments on commit fdb3488

Please sign in to comment.