Skip to content
Snippets Groups Projects
Commit 199db56a authored by Chichi Lalescu's avatar Chichi Lalescu
Browse files

library is no longer an extension

I don't like the way that I'm doing it now, but I don't like the old way
more. With a static library, I no longer need to worry about installing
the package while running a simulation, etc.
Also, now I have full control over the arguments.
parent f0d1a3a7
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,7 @@ try:
lib_dir = os.path.join(os.path.dirname(here), os.pardir)
raise DistributionNotFound
header_dir = os.path.join(os.path.join(dist_loc, 'bfps'), 'cpp')
lib_dir = _dist.location
lib_dir = os.path.join(dist_loc, 'bfps')
__version__ = _dist.version
except DistributionNotFound:
__version__ = ''
......
......@@ -140,10 +140,7 @@ class code(base):
raise IOError('header not there:\n' +
'{0}\n'.format(os.path.join(bfps.header_dir, 'base.hpp')) +
'{0}\n'.format(bfps.dist_loc))
if sys.version_info[0] == 2:
libraries = ['bfps']
else:
libraries = ['bfps.cpython-{0}{1}m'.format(sys.version_info[0], sys.version_info[1])]
libraries += bfps.install_info['libraries']
command_strings = ['g++']
......
......@@ -62,8 +62,8 @@ src_file_list = ['field_descriptor',
header_list = ['cpp/base.hpp'] + ['cpp/' + fname + '.hpp' for fname in src_file_list]
with open('MANIFEST.in', 'w') as manifest_in_file:
manifest_in_file.write('include libbfps.a\n')
#with open('MANIFEST.in', 'w') as manifest_in_file:
# manifest_in_file.write('include libbfps.a\n')
# for fname in ['bfps/cpp/' + fname + '.cpp' for fname in src_file_list] + header_list:
# manifest_in_file.write('include {0}\n'.format(fname))
......@@ -84,11 +84,13 @@ pickle.dump(
open('bfps/install_info.pickle', 'wb'),
protocol = 2)
from distutils.command.install import install as DistutilsInstall
from distutils.command.build import build as DistutilsBuild
class CustomInstall(DistutilsInstall):
class CustomBuild(DistutilsBuild):
def run(self):
# compile bfps library
if not os.path.isdir('obj'):
os.makedirs('obj')
for fname in src_file_list:
ifile = 'bfps/cpp/' + fname + '.cpp'
ofile = 'obj/' + fname + '.o'
......@@ -106,14 +108,14 @@ class CustomInstall(DistutilsInstall):
command_strings.append('-Ibfps/cpp/')
print(' '.join(command_strings))
subprocess.call(command_strings)
command_strings = ['ar', 'rvs', 'libbfps.a']
command_strings = ['ar', 'rvs', 'bfps/libbfps.a']
command_strings += ['obj/' + fname + '.o' for fname in src_file_list]
#command_strings += ['-l' + libname for libname in libraries]
#command_strings += ['-L' + ldir for ldir in library_dirs]
#command_strings += ['-o', 'libbfps.a']
print(' '.join(command_strings))
subprocess.call(command_strings)
DistutilsInstall.run(self)
DistutilsBuild.run(self)
from setuptools import setup
......@@ -121,7 +123,7 @@ setup(
name = 'bfps',
packages = ['bfps'],
install_requires = ['numpy>=1.8', 'h5py>=2.2.1'],
cmdclass={'install': CustomInstall},
cmdclass={'build': CustomBuild},
package_data = {'bfps': header_list + ['../machine_settings.py',
'libbfps.a',
'install_info.pickle']},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment