# ----------------------------------------------------------------------------
#
# Package       : nbsetuptools
# Version       : 0.1.5
# Source repo   : https://github.com/Anaconda-Platform/nbsetuptools.git
# Tested on     : ubuntu_16.04
# Script License: Apache License, Version 2 or later
# Maintainer    : ajay gautam <agautam@us.ibm.com>
#
# Disclaimer: This script has been tested in non-root mode on given
# ==========  platform using the mentioned version of the package.
#             It may not work as expected with newer versions of the
#             package and/or distribution. In such case, please
#             contact "Maintainer" of this script.
#
# ----------------------------------------------------------------------------

#!/bin/bash
export DEBIAN_FRONTEND noninteractive

## Update source
sudo apt-get -y update
# Installing dependent packages
sudo apt-get install -y build-essential software-properties-common &&\
sudo apt-get install -y python-setuptools python-dev  git &&\
sudo easy_install pip &&  pip install -U setuptools pytest 

#Clone repo and build
git clone https://github.com/Anaconda-Platform/nbsetuptools.git && cd nbsetuptools 
sudo pip install . &&\
sudo python setup.py install  &&\
##Run all tests except "test_enable". Please refer to https://github.com/Anaconda-Platform/nbsetuptools/issues/12
sudo pytest -k "not test_enable"
sudo apt-get remove -y git && sudo apt-get -y purge &&\
sudo apt-get -y autoremove &&\
cd .. && sudo rm -rf nbsetuptools
