From d6761b5d22e736ed2d7cf214c849a66ccce20b1c Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Wed, 28 Nov 2018 10:18:11 +0100
Subject: [PATCH] Added pypi suff

I added some material needed for pypi packaging.
---
 python/.gitignore  |  2 ++
 python/MANIFEST.in |  2 ++
 python/Makefile    | 15 ++++++++++++++-
 python/README.rst  | 17 +++++++++++++++++
 python/setup.py    | 18 ++++++++++++++++++
 5 files changed, 53 insertions(+), 1 deletion(-)
 create mode 100644 python/MANIFEST.in
 create mode 100644 python/README.rst

diff --git a/python/.gitignore b/python/.gitignore
index aec6832f7..e51cd70d2 100644
--- a/python/.gitignore
+++ b/python/.gitignore
@@ -8,3 +8,5 @@
 !/README
 !/module.type
 !/test
+!/MANIFEST.in
+!/README.rst
diff --git a/python/MANIFEST.in b/python/MANIFEST.in
new file mode 100644
index 000000000..8517867e7
--- /dev/null
+++ b/python/MANIFEST.in
@@ -0,0 +1,2 @@
+include VERSION
+include Plumed.h
diff --git a/python/Makefile b/python/Makefile
index 488b2e924..0bfbf9f4f 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -39,5 +39,18 @@ pip:
 	cp ../src/wrapper/Plumed.h .
 	cp ../VERSION .
 
+ifndef python_bin
+python_bin=python
+endif
+
+.PHONY: pypi
+
+pypi:
+	mkdir -p pypi
+	cp -r test pypi/
+	cp ../src/wrapper/Plumed.h README.rst MANIFEST.in cplumed.pxd plumed.pyx setup.py ../VERSION pypi/
+	cd pypi ; $(python_bin) setup.py sdist
+	echo "now use: $(python_bin) -m twine upload dist/plumed-$(VERSION).tar.gz"
+
 clean:
-	rm -fr *.so plumed.cpp build Plumed.h VERSION
+	rm -fr *.so plumed.cpp build Plumed.h VERSION pypi test/logfile test/bck* pypi
diff --git a/python/README.rst b/python/README.rst
new file mode 100644
index 000000000..210ce3e13
--- /dev/null
+++ b/python/README.rst
@@ -0,0 +1,17 @@
+Python wrappers for plumed
+==========================
+
+Install using the following commands::
+
+     # install dependencies
+     python -m pip install cython numpy
+     # install plumed
+     python -m pip install plumed
+
+WARNING: You will need to also build and install the plumed library (see http://www.plumed.org) and set the environment variable
+`PLUMED_KERNEL` to point to the file `libplumedKernel.so` (or `libplumedKernel.dylib`). Something like this should work::
+
+     PLUMED_KERNEL=/path/to/libplumedKernel.so
+     python
+     >>> import plumed
+     >>> p=plumed.Plumed()
diff --git a/python/setup.py b/python/setup.py
index 0c6f16a89..ffc5fbef6 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -70,10 +70,28 @@ try:
 except:
     include_dirs.append(".")
 
+def readme():
+    with open('README.rst') as f:
+        return f.read()
+
 setup(
   name=plumedname,
   version=plumedversion,
   description='Python interface to PLUMED',
+  long_description=readme(),
+  classifiers=[
+          'Development Status :: 4 - Beta',
+          'Intended Audience :: Science/Research',
+          'Topic :: Scientific/Engineering :: Bio-Informatics',
+          'Topic :: Scientific/Engineering :: Chemistry',
+          'Topic :: Scientific/Engineering :: Physics',
+          'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
+          'Programming Language :: Python :: 2',
+          'Programming Language :: Python :: 2.7',
+          'Programming Language :: Python :: 3',
+          'Programming Language :: Python :: 3.6',
+          'Programming Language :: Python :: 3.7',
+  ],
   author='Gareth A. Tribello',
   author_email='plumed-users@googlegroups.com',
   url='http://www.plumed.org',
-- 
GitLab