Skip to content
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

Add Mac os x installation scripts #46

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
60efffc
Merge pull request #1 from pyne/main
nsryan2 Aug 10, 2020
f14554f
create a macosx sh file
nsryan2 Aug 10, 2020
eabc212
Create macosx install script from mint script
nsryan2 Aug 10, 2020
401d66e
change dependency list name
nsryan2 Aug 10, 2020
f6b8edd
Update brew and pip install lines to include elements of the ubuntu p…
nsryan2 Aug 10, 2020
7432182
Apply suggestions from code review
nsryan2 Aug 10, 2020
48abe72
Update build moab script and add build dagmc to operate with cmake
nsryan2 Aug 10, 2020
1d3b0d8
Add eigen to list of brew package installs
nsryan2 Aug 10, 2020
df3f162
Add hdf5 to the packages
nsryan2 Aug 11, 2020
655ac35
Remove references to hdf5_libdir
nsryan2 Aug 11, 2020
798a948
Remove references to hdf5_libdir
nsryan2 Aug 11, 2020
8fa80d8
Apply suggestions from code review
nsryan2 Aug 11, 2020
0892a60
Update macosx.sh
nsryan2 Aug 11, 2020
de30a2c
Update macosx.sh
nsryan2 Aug 11, 2020
e1b4d0e
Apply suggestions from code review
nsryan2 Aug 11, 2020
d0ef93a
Remove reference to python 2
nsryan2 Aug 11, 2020
234e758
add chmod=+x to the install_scripts folder
nsryan2 Aug 11, 2020
cadaae6
Merge branch 'add_mac' into main
nsryan2 Aug 11, 2020
cfb92d1
Merge pull request #2 from nsryan2/main
nsryan2 Aug 11, 2020
6542c38
Delete osx_10.15.6-stable.dockerfile
nsryan2 Aug 11, 2020
a66978b
Delete .DS_Store
nsryan2 Aug 11, 2020
7c30f01
this should now be working
bam241 Aug 12, 2020
7f9cbba
Merge branch 'add_mac' of https://github.com/nsryan2/install_scripts …
bam241 Aug 12, 2020
71b765e
cleaning
bam241 Aug 12, 2020
d0ad7a6
Merge pull request #3 from bam241/some_fix
nsryan2 Aug 12, 2020
3d32f49
Update macosx.sh
nsryan2 Aug 12, 2020
b6f7e77
Update macosx.sh
nsryan2 Aug 13, 2020
e1facd1
Add the curly brackets around variables
nsryan2 Aug 14, 2020
1f4b113
this should be the last one
bam241 Aug 14, 2020
266a31a
Merge pull request #5 from bam241/some_fix
nsryan2 Aug 14, 2020
2e4facc
convergence in macos and ubuntu scripts
gonuke Aug 14, 2020
b6a126c
Merge pull request #6 from gonuke/add_mac
nsryan2 Aug 14, 2020
1c06a88
Apply suggestions from code review
nsryan2 Aug 14, 2020
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
119 changes: 119 additions & 0 deletions macosx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#!/bin/bash
# This script contains common code for building PyNE on various Debian-derived systems
#

function check_repo() {

repo_name=$1

if [ -d $repo_name ] ; then
nsryan2 marked this conversation as resolved.
Show resolved Hide resolved
nsryan2 marked this conversation as resolved.
Show resolved Hide resolved
read -p "Delete the existing $repo_name directory and all contents? (y/n) " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]] ; then
rm -rf $repo_name
fi
fi

}

function build_moab {

# Install MOAB
cd $install_dir
mkdir -p moab
cd moab
check_repo moab-repo
git clone --branch Version5.1.0 --single-branch https://bitbucket.org/fathomteam/moab moab-repo
cd moab-repo
autoreconf -fi
mkdir -p build
cd build
../configure --enable-shared --enable-dagmc --enable-pymoab --with-hdf5=$hdf5_libdir --prefix=$install_dir/moab
make
make install
export LD_LIBRARY_PATH=$install_dir/moab/lib:$LD_LIBRARY_PATH
export LIBRARY_PATH=$install_dir/moab/lib:$LIBRARY_PATH
echo "export LD_LIBRARY_PATH=$install_dir/moab/lib:\$LD_LIBRARY_PATH" >> ~/.bashrc
echo "export LIBRARY_PATH=$install_dir/moab/lib:\$LIBRARY_PATH" >> ~/.bashrc
echo "export CPLUS_INCLUDE_PATH=$install_dir/moab/include:\$CPLUS_INCLUDE_PATH" >> ~/.bashrc
echo "export C_INCLUDE_PATH=$install_dir/moab/include:\$C_INCLUDE_PATH" >> ~/.bashrc

PYTHON_VERSION= $(python -c 'import sys; print(sys.version.split('')[0][0:3])')
echo "if [ -z \$PYTHONPATH ]" >> ~/.bashrc
nsryan2 marked this conversation as resolved.
Show resolved Hide resolved
echo "then" >> ~/.bashrc >> ~/.bashrc
echo " export PYTHONPATH=$install_dir/moab/lib/python${PYTHON_VERSION}/site-packages" >> ~/.bashrc
echo "else" >> ~/.bashrc
echo " export PYTHONPATH=$install_dir/moab/lib/python${PYTHON_VERSION}/site-packages:\$PYTHONPATH" >> ~/.bashrc
echo "fi" >> ~/.bashrc
}

function install_pyne {

# Install PyNE
cd $install_dir
check_repo pyne
git clone https://github.com/pyne/pyne.git
cd pyne
if [ $1 == 'stable' ] ; then
TAG=$(git describe --abbrev=0 --tags)
git checkout tags/`echo $TAG` -b `echo $TAG`
fi
python setup.py install --user -- -DMOAB_LIBRARY=$install_dir/moab/lib -DMOAB_INCLUDE_DIR=$install_dir/moab/include
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like an "old-fashioned" way to configure setup.py. Why not the --moab and --dagmc options? Also, no DAGMC? Is that not possible?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixing this right now

echo "export PATH=$HOME/.local/bin:\$PATH" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=$HOME/.local/lib:\$LD_LIBRARY_PATH" >> ~/.bashrc
echo "alias build_pyne='python setup.py install --user -- -DMOAB_LIBRARY=$install_dir/moab/lib -DMOAB_INCLUDE_DIR=$install_dir/moab/include'" >> ~/.bashrc

nsryan2 marked this conversation as resolved.
Show resolved Hide resolved
}

function nuc_data_make {

# Generate nuclear data file
export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH
./scripts/nuc_data_make

}

function test_pyne {

cd tests

# check which python version to run correct tests
version=`python -c 'import sys; print(sys.version_info[:][0])'`

# Run all the tests
if [ $version == '2' ] ; then
source ./travis-run-tests.sh python2
elif [ $version == '3' ] ; then
source ./travis-run-tests.sh python3
fi
}


set -euo pipefail
IFS=$'\n\t'

# system update
eval brew update
eval brew install $brew_package_list
export PATH="$HOME/.local/bin:$PATH"
eval python -m pip install --user --upgrade pip
nsryan2 marked this conversation as resolved.
Show resolved Hide resolved
eval pip install --user $pip_package_list
nsryan2 marked this conversation as resolved.
Show resolved Hide resolved

install_dir=$HOME/opt
mkdir -p $install_dir

# need to put libhdf5.so on LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$hdf5_libdir
export LIBRARY_PATH=$hdf5_libdir
echo "export LD_LIBRARY_PATH=$hdf5_libdir" >> ~/.bashrc

build_moab

nsryan2 marked this conversation as resolved.
Show resolved Hide resolved
nsryan2 marked this conversation as resolved.
Show resolved Hide resolved
install_pyne $1

nuc_data_make

test_pyne $1

echo "Run 'source ~/.bashrc' to update environment variables. PyNE may not function correctly without doing so."
echo "PyNE build complete. PyNE can be rebuilt with the alias 'build_pyne' executed from $install_dir/pyne"

24 changes: 24 additions & 0 deletions osx_10.15.6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# This script builds the repo version of PyNE (with the MOAB optional
# dependency) from scratch on MacOS 10.15.6. The folder $HOME/opt is created
# and PyNE is installed within.
#
# Run this script from any directory by issuing the command where <version>
# is either "dev" or "stable":
# $ ./osx_10.15.6.sh <version>
# After the build finishes run:
# $ source ~/.bashrc
# or open a new terminal.

# Use package manager for as many packages as possible
brew_package_list="glib python3 wget \
git cmake vim emacs gcc openblas \
lapack autoconf libtool make"
nsryan2 marked this conversation as resolved.
Show resolved Hide resolved

pip_package_list="numpy scipy cython nose tables matplotlib jinja2 \
setuptools h5py"

hdf5_libdir=/usr/lib/x86_64-linux-gnu/hdf5/serial


source macosx.sh $1