Skip to content

Commit b6a126c

Browse files
authored
Merge pull request #6 from gonuke/add_mac
convergence in macos and ubuntu scripts
2 parents 266a31a + 2e4facc commit b6a126c

File tree

2 files changed

+22
-35
lines changed

2 files changed

+22
-35
lines changed

macosx.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function check_repo() {
88

99
if [ -d ${repo_name} ] ; then
1010
read -p "Delete the existing ${repo_name} directory and all contents? (y/n) " -n 1 -r
11-
if [[ ${REPLY} =~ ^[Yy]$ ]] ; then
11+
if [[ $REPLY =~ ^[Yy]$ ]] ; then
1212
rm -rf ${repo_name}
1313
fi
1414
fi
@@ -36,15 +36,15 @@ function build_moab {
3636
make install
3737

3838
echo "if [ -n \"\${LD_LIBRARY_PATH-}\" ]" >> ~/.bashrc
39-
echo "then" >> ~/.bashrc >> ~/.bashrc
39+
echo "then" >> ~/.bashrc
4040
echo " export LD_LIBRARY_PATH=${install_dir}/moab/lib:\$LD_LIBRARY_PATH" >> ~/.bashrc
4141
echo "else" >> ~/.bashrc
4242
echo " export LD_LIBRARY_PATH=${install_dir}/moab/lib" >> ~/.bashrc
4343
echo "fi" >> ~/.bashrc
4444

4545
PYTHON_VERSION=$(python -c 'import sys; print(sys.version.split('')[0][0:3])')
4646
echo "if [ -n \"\${PYTHONPATH-}\" ]" >> ~/.bashrc
47-
echo "then" >> ~/.bashrc >> ~/.bashrc
47+
echo "then" >> ~/.bashrc
4848
echo " export PYTHONPATH=${install_dir}/moab/lib/python${PYTHON_VERSION}/site-packages:\$PYTHONPATH" >> ~/.bashrc
4949
echo "else" >> ~/.bashrc
5050
echo " export PYTHONPATH=${install_dir}/moab/lib/python${PYTHON_VERSION}/site-packages" >> ~/.bashrc
@@ -80,7 +80,7 @@ function install_pyne {
8080
cd pyne
8181
if [ $1 == 'stable' ] ; then
8282
TAG=$(git describe --abbrev=0 --tags)
83-
git checkout tags/`echo $TAG` -b `echo $TAG`
83+
git checkout tags/`echo ${TAG}` -b `echo ${TAG}`
8484
fi
8585

8686

@@ -94,39 +94,40 @@ function install_pyne {
9494

9595
PYTHON_VERSION=$(python -c 'import sys; print(sys.version.split('')[0][0:3])')
9696
echo "if [ -n \"\${PYTHONPATH-}\" ]" >> ~/.bashrc
97-
echo "then" >> ~/.bashrc >> ~/.bashrc
97+
echo "then" >> ~/.bashrc
9898
echo " export PYTHONPATH=~/.local/lib/python${PYTHON_VERSION}/site-packages:\$PYTHONPATH" >> ~/.bashrc
9999
echo "else" >> ~/.bashrc
100100
echo " export PYTHONPATH=~/.local/lib/python${PYTHON_VERSION}/site-packages" >> ~/.bashrc
101101
echo "fi" >> ~/.bashrc
102+
source ~/.bashrc
102103
}
103104

104105
function run_nuc_data_make {
105106

106107
cd
107-
source ~/.bashrc
108108
# Generate nuclear data file
109109
nuc_data_make
110110

111111
}
112112

113113
function test_pyne {
114114

115-
source ~/.bashrc
116115
cd $install_dir/pyne
117116
cd tests
118117

119118
./travis-run-tests.sh python3
120119
}
121120

121+
set -euo pipefail
122+
IFS=$'\n\t'
122123

123124
# system update
124125
eval brew update
125126
eval brew install ${brew_package_list}
126127
export PATH="${HOME}/.local/bin:${PATH}"
127128
eval sudo pip3 install ${pip_package_list}
128129

129-
nstall_dir=${HOME}/opt
130+
install_dir=${HOME}/opt
130131
mkdir -p ${install_dir}
131132

132133
build_moab
@@ -137,7 +138,7 @@ install_pyne $1
137138

138139
run_nuc_data_make
139140

140-
test_pyne $1
141+
test_pyne
141142

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

ubuntu_mint.sh

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,20 @@ function build_moab {
3434
-DCMAKE_INSTALL_PREFIX=${install_dir}/moab
3535
make
3636
make install
37-
export LD_LIBRARY_PATH=${install_dir}/moab/lib:$LD_LIBRARY_PATH
38-
export LIBRARY_PATH=${install_dir}/moab/lib:$LIBRARY_PATH
39-
if [ -z \$PYTHONPATH ]
40-
then
41-
export PYTHONPATH=${install_dir}/moab/lib/python2.7/site-packages
42-
else
43-
export PYTHONPATH=${install_dir}/moab/lib/python2.7/site-packages:\$PYTHONPATH
44-
fi
37+
4538
echo "export LD_LIBRARY_PATH=${install_dir}/moab/lib:\$LD_LIBRARY_PATH" >> ~/.bashrc
4639
echo "export LIBRARY_PATH=${install_dir}/moab/lib:\$LIBRARY_PATH" >> ~/.bashrc
4740
echo "export CPLUS_INCLUDE_PATH=${install_dir}/moab/include:\$CPLUS_INCLUDE_PATH" >> ~/.bashrc
4841
echo "export C_INCLUDE_PATH=${install_dir}/moab/include:\$C_INCLUDE_PATH" >> ~/.bashrc
4942

5043
PYTHON_VERSION=$(python -c 'import sys; print(sys.version.split('')[0][0:3])')
5144
echo "if [ -z \$PYTHONPATH ]" >> ~/.bashrc
52-
echo "then" >> ~/.bashrc >> ~/.bashrc
45+
echo "then" >> ~/.bashrc
5346
echo " export PYTHONPATH=$install_dir/moab/lib/python${PYTHON_VERSION}/site-packages" >> ~/.bashrc
5447
echo "else" >> ~/.bashrc
5548
echo " export PYTHONPATH=$install_dir/moab/lib/python${PYTHON_VERSION}/site-packages:\$PYTHONPATH" >> ~/.bashrc
5649
echo "fi" >> ~/.bashrc
50+
source ~/.bashrc
5751
}
5852

5953
function build_dagmc {
@@ -92,31 +86,23 @@ function install_pyne {
9286
--clean
9387
echo "export PATH=${HOME}/.local/bin:\$PATH" >> ~/.bashrc
9488
echo "export LD_LIBRARY_PATH=${HOME}/.local/lib:\$LD_LIBRARY_PATH" >> ~/.bashrc
95-
echo "alias build_pyne='python setup.py install --user -- -DMOAB_LIBRARY=${install_dir}/moab/lib -DMOAB_INCLUDE_DIR=${install_dir}/moab/include'" >> ~/.bashrc
96-
89+
source ~/.bashrc
9790
}
9891

99-
function nuc_data_make {
92+
function run_nuc_data_make {
10093

94+
cd
10195
# Generate nuclear data file
102-
export LD_LIBRARY_PATH=${HOME}/.local/lib:${LD_LIBRARY_PATH}
103-
./scripts/nuc_data_make
96+
nuc_data_make
10497

10598
}
10699

107100
function test_pyne {
108101

102+
cd $install_dir/pyne
109103
cd tests
110104

111-
# check which python version to run correct tests
112-
version=`python -c 'import sys; print(sys.version_info[:][0])'`
113-
114-
# Run all the tests
115-
if [ ${version} == '2' ] ; then
116-
source ./travis-run-tests.sh python2
117-
elif [ ${version} == '3' ] ; then
118-
source ./travis-run-tests.sh python3
119-
fi
105+
./travis-run-tests.sh python3
120106
}
121107

122108

@@ -144,9 +130,9 @@ build_dagmc
144130

145131
install_pyne $1
146132

147-
nuc_data_make
133+
run_nuc_data_make
148134

149135
test_pyne
150136

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

0 commit comments

Comments
 (0)