Skip to content

Commit fe5e206

Browse files
author
Dilawar Singh
committed
Merge branch 'master' into LSODE
2 parents e4a5826 + 9489bbd commit fe5e206

File tree

818 files changed

+74873
-109795
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

818 files changed

+74873
-109795
lines changed

.ci/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Run this script from top directory
2+
# docker build . --file .ci/Dockerfile --tag bhallalab/build-wheels:$(date +%s)
3+
FROM bhallalab/python-wheels:latest
4+
MAINTAINER Dilawar Singh <[email protected]>
5+
WORKDIR /root
6+
COPY . /root/moose-core/
7+
# RUN ./build_wheels.sh
8+
CMD [ "./build_wheels.sh" ]

.ci/build_wheels_osx.sh

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/bin/bash
2+
set -e
3+
set -x
4+
5+
BRANCH=$(cat ./BRANCH)
6+
VERSION=3.2.dev$(date +%Y%m%d)
7+
8+
# Just to be sure on homebrew.
9+
export PATH=/usr/local/bin:$PATH
10+
11+
brew update || echo "Failed to update brew"
12+
brew install gsl || brew upgrade gsl
13+
brew upgrade python3 || echo "Failed to upgrade python3"
14+
brew upgrade python2 || echo "Failed to upgrade python2"
15+
brew upgrade python || echo "Failed to upgrade python"
16+
17+
# Following are to remove numpy; It is breaking the build on Xcode9.4.
18+
brew uninstall gdal postgis || echo "Failed to uninstall gdal/postgis"
19+
brew uninstall numpy || echo "Failed to uninstall numpy"
20+
21+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
22+
23+
MOOSE_SOURCE_DIR=`pwd`/moose-core
24+
25+
if [ ! -d $MOOSE_SOURCE_DIR ]; then
26+
git clone https://github.com/BhallaLab/moose-core -b $BRANCH --depth 10
27+
fi
28+
cd moose-core && git pull
29+
WHEELHOUSE=$HOME/wheelhouse
30+
mkdir -p $WHEELHOUSE
31+
# Current version 0.7.4 seems to be broken with python3.7 .
32+
# See https://travis-ci.org/BhallaLab/deploy/jobs/435219820
33+
sudo /usr/local/bin/python -m pip install delocate virtualenv
34+
sudo /usr/local/bin/python3 -m pip install delocate virtualenv
35+
DELOCATE_WHEEL=/usr/local/bin/delocate-wheel
36+
37+
# Always prefer brew version.
38+
for _py in 3 2; do
39+
PYTHON=/usr/local/bin/python$_py
40+
41+
if [ ! -f $PYTHON ]; then
42+
echo "Not found $PYTHON"
43+
continue
44+
fi
45+
46+
$PYTHON -m pip install setuptools --upgrade --user
47+
$PYTHON -m pip install wheel --upgrade --user
48+
$PYTHON -m pip install numpy --upgrade --user
49+
$PYTHON -m pip install twine --upgrade --user
50+
51+
PLATFORM=$($PYTHON -c "import distutils.util; print(distutils.util.get_platform())")
52+
53+
(
54+
cd $MOOSE_SOURCE_DIR
55+
BUILDDIR=_build_$_py
56+
mkdir -p $BUILDDIR && cd $BUILDDIR
57+
echo " -- Building wheel for $PLATFORM"
58+
cmake -DVERSION_MOOSE=$VERSION -DPYTHON_EXECUTABLE=$PYTHON ..
59+
60+
make -j4
61+
(
62+
cd python
63+
ls *.py
64+
sed "s/from distutils.*setup/from setuptools import setup/g" \
65+
setup.cmake.py > setup.wheel.py
66+
$PYTHON setup.wheel.py bdist_wheel -p $PLATFORM
67+
# Now fix the wheel using delocate.
68+
$DELOCATE_WHEEL -w $WHEELHOUSE -v dist/*.whl
69+
)
70+
71+
ls $WHEELHOUSE/pymoose*-py${_py}-*.whl
72+
73+
# create a virtualenv and test this.
74+
rm -rf $HOME/Py${_py}
75+
(
76+
python3 -m virtualenv -p $PYTHON $HOME/Py${_py}
77+
source $HOME/Py${_py}/bin/activate
78+
set +x
79+
python -m pip install $WHEELHOUSE/pymoose*-py${_py}-*.whl
80+
echo "Testing wheel in virtualenv"
81+
which python
82+
python --version
83+
python -c 'import moose; print( moose.__version__ )'
84+
deactivate
85+
set -x
86+
)
87+
)
88+
89+
if [ ! -z "$PYPI_PASSWORD" ]; then
90+
echo "Did you test the wheels? I am uploading anyway ..."
91+
$PYTHON -m twine upload -u bhallalab -p $PYPI_PASSWORD \
92+
$HOME/wheelhouse/pymoose*.whl || echo "Failed to upload to PyPi"
93+
fi
94+
done
File renamed without changes.
File renamed without changes.

.ci/run_pylint.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
python3 -m pip install pylint --user
4+
PYLINT="python3 -m pylint -E \
5+
--disable=no-member --disable=no-name-in-module \
6+
--disable=invalid-unary-operand-type \
7+
--disable=import-error \
8+
"
9+
function do_pylint() {
10+
echo "Checking $1"
11+
DIR=$(dirname $1)
12+
SNAME=$(basename $1)
13+
(
14+
cd $DIR
15+
$PYLINT $@ $SNAME
16+
)
17+
}
18+
19+
FILES=$(find . -type f -name "*.py" | shuf)
20+
N=4
21+
i=0
22+
for f in $FILES; do
23+
#i=$((i+1))
24+
#if [ $i -eq $N ]; then
25+
# i=0
26+
# wait;
27+
#fi
28+
# do_pylint "$f"
29+
echo "Checking $f"
30+
DIR=$(dirname $f)
31+
SNAME=$(basename $f)
32+
(
33+
cd $DIR
34+
$PYLINT $@ $SNAME
35+
)
36+
done

.ci/travis_build_linux.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env bash
2+
#
3+
# DESCRIPTION: Build on linux environment.
4+
#
5+
# AUTHOR: Dilawar Singh (), [email protected]
6+
# ORGANIZATION: NCBS Bangalore
7+
# CREATED: 01/02/2017 10:11:46 AM
8+
9+
set -e
10+
set -x
11+
12+
BUILDDIR=_build_travis
13+
mkdir -p $BUILDDIR
14+
15+
PYTHON2="/usr/bin/python2"
16+
PYTHON3="/usr/bin/python3"
17+
18+
$PYTHON2 -m pip install pip --upgrade --user
19+
$PYTHON2 -m pip install libNeuroML pyNeuroML python-libsbml --upgrade --user
20+
21+
$PYTHON3 -m pip install pip --upgrade --user
22+
$PYTHON3 -m pip install libNeuroML pyNeuroML python-libsbml --upgrade --user
23+
24+
# sympy is only needed for pretty-priting for one test.
25+
$PYTHON3 -m pip install sympy --upgrade --user
26+
27+
NPROC=$(nproc)
28+
MAKE="make -j$NPROC"
29+
30+
unset PYTHONPATH
31+
32+
# Bug: `which python` returns /opt/bin/python* etc on travis. For which numpy
33+
# many not be available. Therefore, it is neccessary to use fixed path for
34+
# python executable.
35+
36+
$PYTHON2 -m compileall -q .
37+
$PYTHON3 -m compileall -q .
38+
39+
# Python3 with GSL in debug more.
40+
(
41+
mkdir -p $BUILDDIR && cd $BUILDDIR && \
42+
cmake -DPYTHON_EXECUTABLE=$PYTHON3 \
43+
-DCMAKE_INSTALL_PREFIX=/usr -DDEBUG=ON ..
44+
$MAKE
45+
# Run with valgrind to log any memory leak.
46+
valgrind --leak-check=full ./moose.bin -q -u
47+
48+
# Run all tests in debug mode.
49+
MOOSE_NUM_THREADS=$NPROC ctest -j$NPROC --output-on-failure
50+
make install || sudo make install
51+
cd /tmp
52+
$PYTHON3 -c 'import moose;print(moose.__file__);print(moose.version())'
53+
)
54+
55+
# GSL and python2, failure is allowed
56+
set +e
57+
(
58+
mkdir -p $BUILDDIR && cd $BUILDDIR && \
59+
cmake -DPYTHON_EXECUTABLE=$PYTHON2 -DCMAKE_INSTALL_PREFIX=/usr ..
60+
$MAKE && MOOSE_NUM_THREADS=$NPROC ctest -j$NPROC --output-on-failure
61+
)
62+
set -e
63+
64+
65+
# BOOST and python3
66+
(
67+
mkdir -p $BUILDDIR && cd $BUILDDIR && \
68+
cmake -DWITH_BOOST_ODE=ON -DPYTHON_EXECUTABLE="$PYTHON3" \
69+
-DCMAKE_INSTALL_PREFIX=/usr ..
70+
$MAKE && MOOSE_NUM_THREADS=$NPROC ctest -j$NPROC --output-on-failure
71+
)
72+
73+
echo "All done"

.travis/travis_build_osx.sh renamed to .ci/travis_build_osx.sh

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,31 @@
2020
set -o nounset # Treat unset variables as an error
2121
set -e
2222

23-
# NOTE: On travis, don't enable -j`nproc` option. It may not compile properly.
23+
BUILDDIR=_build_travis
2424

25+
NPROC=$(nproc)
2526
(
26-
2727
# Make sure not to pick up python from /opt.
28-
PATH=/usr/bin:/usr/local/bin:$PATH
29-
mkdir -p _GSL_BUILD && cd _GSL_BUILD \
30-
&& cmake -DDEBUG=ON \
31-
-DPYTHON_EXECUTABLE=`which python` ..
32-
make && ctest --output-on-failure
28+
PATH=/usr/local/bin:/usr/bin:$PATH
3329

34-
cd .. # Now with boost.
35-
mkdir -p _BOOST_BUILD && cd _BOOST_BUILD \
36-
&& cmake -DWITH_BOOST_ODE=ON -DDEBUG=ON \
37-
-DPYTHON_EXECUTABLE=`which python` ..
30+
PYTHON3=$(which python3)
31+
32+
# Get pylint
33+
$PYTHON3 -m pip install pylint --user
34+
$PYTHON3 -m pip install python-libsbml --user
35+
$PYTHON3 -m pip install pyneuroml --user
3836

39-
make && ctest --output-on-failure
40-
cd ..
41-
set +e
37+
mkdir -p $BUILDDIR && cd $BUILDDIR \
38+
&& cmake -DPYTHON_EXECUTABLE=$PYTHON3 \
39+
..
40+
make pylint -j$NPROC
41+
make -j$NPROC && MOOSE_NUM_THREAD=$NPROC ctest --output-on-failure -j$NPROC
4242

43+
cd .. # Now with boost.
44+
mkdir -p $BUILDDIR && cd $BUILDDIR \
45+
&& cmake -DWITH_BOOST_ODE=ON \
46+
-DPYTHON_EXECUTABLE=`which python3` ..
47+
48+
make -j$NPROC && MOOSE_NUM_THREAD=$NPROC ctest -j$NPROC --output-on-failure
4349
)
4450
set +e
45-

.ci/travis_prepare_linux.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash -
2+
#
3+
# DESCRIPTION: Prepare linux build environment on travis.
4+
# NOTES: Always run with sudo permission.
5+
# AUTHOR: Dilawar Singh (), [email protected]
6+
# ORGANIZATION: NCBS Bangalore
7+
# CREATED: 01/02/2017 10:10:02 AM
8+
9+
set -e -x
10+
apt update
11+
apt-get install -qq libxml2-dev libbz2-dev
12+
apt-get install -qq make cmake
13+
apt-get install -qq python-numpy python-matplotlib python-networkx python-pip
14+
apt-get install -qq python3-numpy python3-matplotlib python3-networkx python3-pip
15+
apt-get install -qq python-tk python3-tk
16+
apt-get install -qq valgrind
17+
18+
# Gsl
19+
apt-get install -qq libgsl0-dev || apt-get install -qq libgsl-dev
20+
21+
# Boost related.
22+
apt-get install -qq liblapack-dev
23+
apt-get install -qq libboost-all-dev
24+
25+
# Dependencies for NML2
26+
apt-get install -qq python-scipy python3-scipy
27+
apt-get install -qq python-lxml python3-lxml
28+
apt-get install -qq python-setuptools python3-setuptools
29+
30+
# Install twine
31+
python3 -m pip install twine

.travis/travis_prepare_osx.sh renamed to .ci/travis_prepare_osx.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,28 @@
2020
set -o nounset # Treat unset variables as an error
2121
set +e
2222
#rvm get head
23-
#brew update
24-
#brew outdated cmake || brew install cmake
25-
brew install gsl
23+
brew update || echo "failed to update"
24+
brew outdated cmake || brew install cmake
25+
brew install gsl || brew upgrade gsl
2626
brew install hdf5
2727
brew install python
2828
brew install numpy
2929
brew install boost
3030

31+
PYTHON3=$(which python3)
32+
3133
#brew outdated python || brew install python
3234
#brew outdated numpy || brew install homebrew/python/numpy
3335
brew unlink numpy && brew link numpy || echo "Failed to link numpy"
3436
# Numpy caveats
35-
mkdir -p $HOME/Library/Python/2.7/lib/python/site-packages
36-
echo 'import sys; sys.path.insert(1, "/usr/local/lib/python2.7/site-packages")' >> $HOME/Library/Python/2.7/lib/python/site-packages/homebrew.pth
37+
#mkdir -p $HOME/Library/Python/2.7/lib/python/site-packages
38+
#echo 'import sys; sys.path.insert(1, "/usr/local/lib/python2.7/site-packages")' >> $HOME/Library/Python/2.7/lib/python/site-packages/homebrew.pth
3739

3840
# To make sure that we do not pick python from /opt etc.
3941
PATH=/usr/local/bin:/usr/bin:$PATH
4042
# ensurepip
41-
python -m ensurepip
42-
python -m pip install matplotlib --user --upgrade
43-
python -m pip install pyNeuroML libNeuroML --user
44-
python -m pip install scipy --user
43+
$PYTHON3 -m ensurepip
44+
$PYTHON3 -m pip install matplotlib --user --upgrade
45+
$PYTHON3 -m pip install pyNeuroML libNeuroML --user
46+
$PYTHON3 -m pip install scipy --user
47+
$PYTHON3 -m pip install pylint --user

.github/main.workflow

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
workflow "build pymoose" {
2+
resolves = "build"
3+
on = "push"
4+
}
5+
6+
action "build" {
7+
uses = "./"
8+
args = "install"
9+
env = {
10+
CMAKE_GIT_REPO = "https://github.com/dilawar/moose-core",
11+
CMAKE_INSTALL_DEPS_SCRIPT = ".travis/travis_prepare_linux.sh",
12+
CMAKE_FLAGS = "-DCMAKE_INSTALL_PREFIX:PATH=/tmp/foo",
13+
CMAKE_BUILD_THREADS = "4"
14+
}
15+
}

0 commit comments

Comments
 (0)