Skip to content

Build script improvements #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,21 @@ def get_versions():

includes.append(os.path.join(boost_prefix, 'include'))
if 'BOOST_VERSION' in os.environ:
includes.append(os.path.join(boost_prefix, 'include',
"boost-%s" %os.environ['BOOST_VERSION']))
for boost_dir in ('boost-%s', 'boost%s'):
if os.path.isdir(os.path.join(boost_prefix, 'include', boost_dir % os.environ['BOOST_VERSION'])):
includes.append(os.path.join(boost_prefix, 'include', boost_dir %os.environ['BOOST_VERSION']))
break
else:
raise Exception("Cannot find boost headers")
elif 'BOOST_PREFIX' in os.environ:
if os.path.isdir(os.path.join(boost_prefix, 'include', 'boost')):
includes.append(os.path.join(boost_prefix, 'include', 'boost'))
else:
raise Exception("Cannot find boost headers")

if 'BOOST_VERSION' in os.environ:
if 'BOOST_PREFIX' in os.environ:
libdirs.append(os.path.join(boost_prefix, 'lib'))
elif osplatform in ["linux", "linux2"]:
elif osplatform in ["linux", "linux2"] and os.path.isdir('/usr/lib/x86_64-linux-gnu/'):
libdirs.append('/usr/lib/x86_64-linux-gnu/')
else:
libdirs.append(os.path.join(boost_prefix, 'lib'))
Expand Down Expand Up @@ -118,10 +127,20 @@ def cpp_compiler(compiler):
print("Using global libosmium.")

### protozero dependencies
for prefix in [ 'protozero-' + protozero_version, '../protozero' ]:
if os.path.isfile(os.path.join(prefix, 'include/protozero/version.hpp')):
print("protozero found in '%s'" % prefix)
includes.insert(0, os.path.join(prefix, 'include'))
if 'PROTOZERO_PREFIX' in os.environ:
pz_version_h = os.path.join(os.environ['PROTOZERO_PREFIX'],
'include', 'protozero', 'version.hpp')
if not os.path.isfile(pz_version_h):
raise RuntimeError("PROTOZERO_PREFIX is set but no protozero was found in '%s'" % os.environ['PROTOZERO_PREFIX'])
includes.insert(0, os.path.join(os.environ['PROTOZERO_PREFIX'], 'include'))
else:
for prefix in [ 'protozero-' + protozero_version, '../protozero', 'protozero' ]:
if os.path.isfile(os.path.join(prefix, 'include/protozero/version.hpp')):
print("protozero found in '%s'" % prefix)
includes.insert(0, os.path.join(prefix, 'include'))
break
else:
raise RuntimeError("Protozero not found")

if osplatform == "win32" :
osmium_libs = ('expat', 'zlib', 'bzip2', 'ws2_32')
Expand Down Expand Up @@ -202,4 +221,3 @@ def cpp_compiler(compiler):
cmdclass={'sdist' : My_sdist},
ext_modules = extensions)