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

2020-03-10 |Pulling in changes from subtree #265

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .travis_build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ if [ -n "$TRAVIS" ]; then
echo "We are on travis"
sudo dpkg -i ../*.deb
sudo apt-get install -f
python -c 'import moose; print(moose.__file__); print(moose.__version__)'
python -c 'import moose; print(moose.about())' || python3 -c 'import moose; print(moose.about())'
fi
1 change: 1 addition & 0 deletions .travis_prepare_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sudo apt-get update -qq
sudo apt-get -y install libxml2-dev libbz2-dev wget
sudo apt-get -y install libhdf5-serial-dev
sudo apt-get -y install python-numpy python-setuptools python-networkx python-pip
sudo apt-get -y install python3-numpy python3-setuptools python3-matplotlib
sudo apt-get -y install cmake cdbs
sudo apt-get -y install libgsl0-dev
sudo apt-get -y install python-suds python-matplotlib
Expand Down
34 changes: 18 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@ cmake_minimum_required(VERSION 2.8)
project(moose)
set(CMAKE_BUILD_TYPE Release)

# If from command line, version info is not passed, use the git to generate a
# version file. If GIT fails, use the previous known version.
find_program(GIT_EXEC "git")
message( STATUS "Looking for git ${GIT_EXEC}" )
if(VERSION_MOOSE)
message( STATUS "MOOSE version is set to ${VERSION_MOOSE} at build time" )
elseif(GIT_EXEC)
message( STATUS "Getting version by reading git tags" )
execute_process(
COMMAND ${GIT_EXEC} describe --tags --long
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
set(Python_ADDITIONAL_VERSIONS 2.7)
find_package(PythonInterp 3.5)
if(NOT PYTHONINTERP_FOUND)
find_package(PythonInterp 2.7)
endif()

# NOTE: version should be changed in setup.py file.
# If moose version is not given, use setup.py file to get the default version.
if(NOT VERSION_MOOSE)
execute_process(COMMAND ${PYTHON_EXECUTABLE} setup.py --version
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/moose-core
OUTPUT_VARIABLE VERSION_MOOSE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif( )
message( STATUS "Building version ${VERSION_MOOSE}" )
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()

add_definitions(-DVERSION_MOOSE="${VERSION_MOOSE}")
message(STATUS "MOOSE Version ${VERSION_MOOSE}")


# Prefix
message( STATUS "CMAKE_INSTALL_PREFIX= ${CMAKE_INSTALL_PREFIX}" )
Expand Down Expand Up @@ -79,7 +81,7 @@ add_custom_command( OUTPUT ${OUTPUT_MOOSEBIN}
)
add_custom_command( TARGET moose-core POST_BUILD
COMMAND ${CMAKE_COMMAND} -E chdir ${PYMOOSE_INSTALL_DIR} tar xvf
${PYMOOSE_BUILD_DIR}/bdist/pymoose-${VERSION_MOOSE}.CMAKE.tar.gz
${PYMOOSE_BUILD_DIR}/pymoose-${VERSION_MOOSE}.CMAKE.tar.gz
COMMENT "Unarchiving pymoose bdist"
VERBATIM
)
Expand Down
1 change: 0 additions & 1 deletion cmake/build_moose-core.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ cmake -DCMAKE_INSTALL_PREFIX=@PYMOOSE_INSTALL_DIR@ \
@CMAKE_PYMOOSE_ARGS@ \
@PYMOOSE_SOURCE_DIR@
make $MAKEOPTS
make bdist
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
moose (3.3.0.3ubuntu1) experimental; urgency=medium

* version bumped

-- Dilawar Singh <[email protected]> Fri, 13 Mar 2020 11:21:25 +0530

moose (3.2.0.3ubuntu1) experimental; urgency=medium

* Version bumped.
Expand Down
4 changes: 2 additions & 2 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/make -f

export MAKEOPTS=-j5
export MAKEOPTS=-j$(shell nproc)

export DH_VERBOSE=1

%:
dh "$@" --buildsystem=cmake --with-python2

override_dh_auto_configure:
dh_auto_configure -- -DVERSION_MOOSE=3.2.0-dev -DCMAKE_SKIP_RPATH=ON
dh_auto_configure -- -DCMAKE_SKIP_RPATH=ON

override_dh_python2:
dh_numpy
Expand Down
8 changes: 8 additions & 0 deletions moose-core/.ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Run this script from top directory
# docker build . --file .ci/Dockerfile --tag bhallalab/build-wheels:$(date +%s)
FROM bhallalab/python-wheels:latest
MAINTAINER Dilawar Singh <[email protected]>
WORKDIR /root
COPY . /root/moose-core/
# RUN ./build_wheels.sh
CMD [ "./build_wheels.sh" ]
94 changes: 94 additions & 0 deletions moose-core/.ci/build_wheels_osx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/bin/bash
set -e
set -x

BRANCH=$(cat ./BRANCH)
VERSION=3.2.dev$(date +%Y%m%d)

# Just to be sure on homebrew.
export PATH=/usr/local/bin:$PATH

brew update || echo "Failed to update brew"
brew install gsl || brew upgrade gsl
brew upgrade python3 || echo "Failed to upgrade python3"
brew upgrade python2 || echo "Failed to upgrade python2"
brew upgrade python || echo "Failed to upgrade python"

# Following are to remove numpy; It is breaking the build on Xcode9.4.
brew uninstall gdal postgis || echo "Failed to uninstall gdal/postgis"
brew uninstall numpy || echo "Failed to uninstall numpy"

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

MOOSE_SOURCE_DIR=`pwd`/moose-core

if [ ! -d $MOOSE_SOURCE_DIR ]; then
git clone https://github.com/BhallaLab/moose-core -b $BRANCH --depth 10
fi
cd moose-core && git pull
WHEELHOUSE=$HOME/wheelhouse
mkdir -p $WHEELHOUSE
# Current version 0.7.4 seems to be broken with python3.7 .
# See https://travis-ci.org/BhallaLab/deploy/jobs/435219820
sudo /usr/local/bin/python -m pip install delocate virtualenv
sudo /usr/local/bin/python3 -m pip install delocate virtualenv
DELOCATE_WHEEL=/usr/local/bin/delocate-wheel

# Always prefer brew version.
for _py in 3 2; do
PYTHON=/usr/local/bin/python$_py

if [ ! -f $PYTHON ]; then
echo "Not found $PYTHON"
continue
fi

$PYTHON -m pip install setuptools --upgrade --user
$PYTHON -m pip install wheel --upgrade --user
$PYTHON -m pip install numpy --upgrade --user
$PYTHON -m pip install twine --upgrade --user

PLATFORM=$($PYTHON -c "import distutils.util; print(distutils.util.get_platform())")

(
cd $MOOSE_SOURCE_DIR
BUILDDIR=_build_$_py
mkdir -p $BUILDDIR && cd $BUILDDIR
echo " -- Building wheel for $PLATFORM"
cmake -DVERSION_MOOSE=$VERSION -DPYTHON_EXECUTABLE=$PYTHON ..

make -j4
(
cd python
ls *.py
sed "s/from distutils.*setup/from setuptools import setup/g" \
setup.cmake.py > setup.wheel.py
$PYTHON setup.wheel.py bdist_wheel -p $PLATFORM
# Now fix the wheel using delocate.
$DELOCATE_WHEEL -w $WHEELHOUSE -v dist/*.whl
)

ls $WHEELHOUSE/pymoose*-py${_py}-*.whl

# create a virtualenv and test this.
rm -rf $HOME/Py${_py}
(
python3 -m virtualenv -p $PYTHON $HOME/Py${_py}
source $HOME/Py${_py}/bin/activate
set +x
python -m pip install $WHEELHOUSE/pymoose*-py${_py}-*.whl
echo "Testing wheel in virtualenv"
which python
python --version
python -c 'import moose; print( moose.__version__ )'
deactivate
set -x
)
)

if [ ! -z "$PYPI_PASSWORD" ]; then
echo "Did you test the wheels? I am uploading anyway ..."
$PYTHON -m twine upload -u bhallalab -p $PYPI_PASSWORD \
$HOME/wheelhouse/pymoose*.whl || echo "Failed to upload to PyPi"
fi
done
8 changes: 8 additions & 0 deletions moose-core/.ci/coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
python3 -m trace --count \
--ignore-dir=/usr/lib64 \
--ignore-module=libsbml \
--ignore-module=numpy \
--ignore-module=neuroml \
"$@"

File renamed without changes.
File renamed without changes.
80 changes: 80 additions & 0 deletions moose-core/.ci/travis_build_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/usr/bin/env bash
#
# DESCRIPTION: Build on linux environment.
#
# AUTHOR: Dilawar Singh (), [email protected]
# ORGANIZATION: NCBS Bangalore
# CREATED: 01/02/2017 10:11:46 AM

set -e
set -x

BUILDDIR=_build_travis
mkdir -p $BUILDDIR

PYTHON2="/usr/bin/python2"
PYTHON3="/usr/bin/python3"

$PYTHON2 -m pip install pip --upgrade --user
$PYTHON2 -m pip install libNeuroML numpy==1.14 scipy==1.2 \
pyNeuroML python-libsbml --upgrade --user

$PYTHON3 -m pip install pip --upgrade --user
$PYTHON3 -m pip install libNeuroML pyNeuroML python-libsbml --upgrade --user

# sympy is only needed for pretty-priting for one test.
$PYTHON3 -m pip install numpy sympy scipy --upgrade --user

# pytest requirements.
$PYTHON3 -m pip install -r ./tests/requirements.txt --user

NPROC=$(nproc)
MAKE="make -j$NPROC"

unset PYTHONPATH

# Bug: `which python` returns /opt/bin/python* etc on travis. For which numpy
# many not be available. Therefore, it is neccessary to use fixed path for
# python executable.

$PYTHON2 -m compileall -q .
$PYTHON3 -m compileall -q .

# Python3 with GSL in debug more.
(
mkdir -p $BUILDDIR && cd $BUILDDIR && \
cmake -DPYTHON_EXECUTABLE=$PYTHON3 \
-DCMAKE_INSTALL_PREFIX=/usr -DDEBUG=ON ..
$MAKE
# Run with valgrind to log any memory leak.
valgrind --leak-check=full ./moose.bin -q -u

# Run all tests in debug mode.
MOOSE_NUM_THREADS=$NPROC ctest -j$NPROC --output-on-failure


make install || sudo make install
cd /tmp
$PYTHON3 -c 'import moose;print(moose.__file__);print(moose.version())'
)

# BOOST and python3
(
mkdir -p $BUILDDIR && cd $BUILDDIR && \
cmake -DWITH_BOOST_ODE=ON -DPYTHON_EXECUTABLE="$PYTHON3" \
-DCMAKE_INSTALL_PREFIX=/usr ..
# Run coverage
export MOOSE_NUM_THREADS=3
make coverage
)

# GSL and python2, failure is allowed
set +e
(
mkdir -p $BUILDDIR && cd $BUILDDIR && \
cmake -DPYTHON_EXECUTABLE=$PYTHON2 -DCMAKE_INSTALL_PREFIX=/usr ..
$MAKE && MOOSE_NUM_THREADS=$NPROC ctest -j$NPROC --output-on-failure
)
set -e

echo "All done"
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
set -o nounset # Treat unset variables as an error
set -e

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

NPROC=$(nproc)
(
# Make sure not to pick up python from /opt.
PATH=/usr/local/bin:/usr/bin:$PATH
Expand All @@ -33,22 +34,17 @@ set -e
$PYTHON3 -m pip install python-libsbml --user
$PYTHON3 -m pip install pyneuroml --user

mkdir -p _GSL_BUILD && cd _GSL_BUILD \
&& cmake -DDEBUG=ON \
-DPYTHON_EXECUTABLE=$PYTHON3 \
mkdir -p $BUILDDIR && cd $BUILDDIR \
&& cmake -DPYTHON_EXECUTABLE=$PYTHON3 \
..
make pylint -j3
make && ctest --output-on-failure
make pylint -j$NPROC
make -j$NPROC && MOOSE_NUM_THREAD=$NPROC ctest --output-on-failure -j$NPROC

cd .. # Now with boost.
mkdir -p _BOOST_BUILD && cd _BOOST_BUILD \
&& cmake -DWITH_BOOST_ODE=ON -DDEBUG=ON \
mkdir -p $BUILDDIR && cd $BUILDDIR \
&& cmake -DWITH_BOOST_ODE=ON \
-DPYTHON_EXECUTABLE=`which python3` ..

make -j4 && ctest --output-on-failure
cd ..
set +e

make -j$NPROC && MOOSE_NUM_THREAD=$NPROC ctest -j$NPROC --output-on-failure
)
set +e

31 changes: 31 additions & 0 deletions moose-core/.ci/travis_prepare_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash -
#
# DESCRIPTION: Prepare linux build environment on travis.
# NOTES: Always run with sudo permission.
# AUTHOR: Dilawar Singh (), [email protected]
# ORGANIZATION: NCBS Bangalore
# CREATED: 01/02/2017 10:10:02 AM

set -e -x
apt update
apt-get install -qq libxml2-dev libbz2-dev
apt-get install -qq make cmake
apt-get install -qq python-numpy python-matplotlib python-networkx python-pip
apt-get install -qq python3-numpy python3-matplotlib python3-networkx python3-pip
apt-get install -qq python-tk python3-tk
apt-get install -qq valgrind

# Gsl
apt-get install -qq libgsl0-dev || apt-get install -qq libgsl-dev

# Boost related.
apt-get install -qq liblapack-dev
apt-get install -qq libboost-all-dev

# Dependencies for NML2
apt-get install -qq python-scipy python3-scipy
apt-get install -qq python-lxml python3-lxml
apt-get install -qq python-setuptools python3-setuptools

# Install twine
python3 -m pip install twine
15 changes: 15 additions & 0 deletions moose-core/.github/main.workflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
workflow "build pymoose" {
resolves = "build"
on = "push"
}

action "build" {
uses = "./"
args = "install"
env = {
CMAKE_GIT_REPO = "https://github.com/dilawar/moose-core",
CMAKE_INSTALL_DEPS_SCRIPT = ".travis/travis_prepare_linux.sh",
CMAKE_FLAGS = "-DCMAKE_INSTALL_PREFIX:PATH=/tmp/foo",
CMAKE_BUILD_THREADS = "4"
}
}
Loading