Skip to content

Commit

Permalink
Configure twice in order to build package from clean SEACAS repo.
Browse files Browse the repository at this point in the history
Due to the exodus3.in.py needing cmake variable replacement and
to be moved before the setup.py is run, it is needed to call
the configure before the instanciation of setup. However,
because the congfigure needs variables to be set during build
time it needs to be called again to make sure the libraries
are placed in the correct place for pick up by the package.py
  • Loading branch information
mvlopri committed Jun 22, 2023
1 parent 4f7e77e commit 6608e8f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
7 changes: 1 addition & 6 deletions exo_build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,9 @@ def build_extensions(self):
build_dir = os.path.join(os.getcwd(), "build")
env = dict(os.environ)
env["JOBS"] = str(os.cpu_count())
env["MPI"] = "YES"
subprocess.check_call(['./install-tpl.sh'] + cmake_args, env=env)
with contextlib.suppress(Exception):
os.mkdir("build")
env["MPI"] = "NO"
subprocess.check_call(['../cmake-exodus'] + cmake_args, cwd=build_dir, env=env)

# Build
subprocess.check_call(['cmake', '--build', '.'], cwd=build_dir, env=env)
subprocess.check_call(['cmake', '--install', '.'], cwd=build_dir, env=env)
# for sofile in list(Path('lib/').glob('*.so*')):
# shutil.copy(str(sofile), extdir)
16 changes: 15 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
#!/usr/bin/env python

import os
import subprocess
import contextlib
from setuptools import setup, Extension
from glob import glob
from exo_build_ext import cmake_build_ext


# Config
build_dir = os.path.join(os.getcwd(), "build")
env = dict(os.environ)
env["JOBS"] = str(os.cpu_count())
env["MPI"] = "NO"
subprocess.check_call(['./install-tpl.sh'], env=env)
with contextlib.suppress(Exception):
os.mkdir("build")
subprocess.check_call(['../cmake-exodus'], cwd=build_dir, env=env)

s = setup(name='seacas-exodus',
description='A python wrapper of some of the exodus library',
description='A python wrapper of the exodus library',
version='1.21.1',
url='https://github.com/sandialabs/seacas',
py_modules=['exodus3'],
Expand Down

0 comments on commit 6608e8f

Please sign in to comment.