From 768b7f9b93b436f1381c82d5036220856d47b929 Mon Sep 17 00:00:00 2001
From: vtraag <vincent@traag.net>
Date: Sun, 12 Nov 2017 14:06:28 +0100
Subject: [PATCH] Finalised release script and updated CHANGELOG.

---
 CHANGELOG  |  2 +-
 release.sh | 75 ++++++++++++++++++++++++++++++++----------------------
 2 files changed, 46 insertions(+), 31 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 2e136e1..085c332 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,6 @@
 0.6.0
 - Major API changes, now exposing actual classes and optimisation routine.
-- Improved algorithm, now runs much faster and finds better solutions.
+- Improved algorithm, now runs faster and finds better solutions.
 - Improved error handling, doing more type checking.
 - Improved documentation throughout, now done using Sphinx and available from
   readthedocs.org.
diff --git a/release.sh b/release.sh
index d33b3ac..d5070dd 100644
--- a/release.sh
+++ b/release.sh
@@ -1,34 +1,49 @@
 #!/bin/sh
 
-mkdir /tmp/louvain/
-cp -R * /tmp/louvain/
-
-cd /tmp/louvain/
-
-# source dist 
-source ~/anaconda3/bin/activate root
-python setup.py sdist
-#python setup.py sdist upload --sign
-#python2.7 setup.py bdist_egg upload --sign
-#python3.4 setup.py bdist_egg upload --sign
-
-# docs will be built automatically by readthedocs.org
-# python setup.py build_sphinx
-
-# Conda packages
-conda config --set anaconda_upload yes
-source ~/anaconda3/bin/activate root
-python setup.py --no-pkg-config bdist_conda
-
-~/miniconda3/bin/python setup.py --no-pkg-config bdist_conda
-~/miniconda3/bin/anaconda upload -i ~/miniconda3/conda-bld/linux-64/louvain-0.5.3-py35_0.tar.bz2
-
-cd -
-
-if [ ! -d "dist/" ]; then
-  mkdir dist/
+if [ "$1" = "release" ]; then
+  echo "Making release, uploading to PyPi and Anaconda..."
+  # source dist 
+  source ~/anaconda2/bin/activate root
+  python setup.py sdist upload --sign
+  python setup.py bdist_egg upload --sign
+  
+  source ~/anaconda3/bin/activate root
+  python setup.py bdist_egg upload --sign
+  
+  # docs will be built automatically by readthedocs.org
+  # python setup.py build_sphinx
+  
+  # Conda packages
+  ~/anaconda2/bin/conda config --set anaconda_upload yes
+  source ~/anaconda2/bin/activate root
+  python setup.py --no-pkg-config bdist_conda
+  
+  ~/anaconda3/bin/conda config --set anaconda_upload yes
+  source ~/anaconda3/bin/activate root
+  python setup.py --no-pkg-config bdist_conda
+else
+  echo "Dry run, not uploading anything..."
+  # source dist 
+  source ~/anaconda2/bin/activate root
+  python setup.py sdist
+  python setup.py bdist_egg
+  
+  source ~/anaconda3/bin/activate root
+  python setup.py sdist
+  python setup.py sdist
+  python setup.py bdist_egg
+  
+  # docs will be built automatically by readthedocs.org
+  # but let's test if there is not anything going wrong
+  python setup.py build_sphinx
+  
+  # Conda packages
+  ~/anaconda2/bin/conda config --set anaconda_upload no
+  source ~/anaconda2/bin/activate root
+  python setup.py --no-pkg-config bdist_conda
+  
+  ~/anaconda3/bin/conda config --set anaconda_upload no
+  source ~/anaconda3/bin/activate root
+  python setup.py --no-pkg-config bdist_conda
 fi
 
-cp /tmp/louvain/dist/* dist/
-
-rm -rf /tmp/louvain/