#!/usr/bin/env python

################################################################################
# Copyright (C) 2011-2015 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################


# Read version number __version__ from the file
# See: https://packaging.python.org/en/latest/single_source_version/#single-sourcing-the-version
import os
version = {}
with open(os.path.join('bayespy', 'version.py')) as fp:
    exec(fp.read(), version)
__version__ = version['__version__']

NAME         = 'bayespy'
DESCRIPTION  = 'Variational Bayesian inference tools for Python'
AUTHOR       = 'Jaakko Luttinen'
AUTHOR_EMAIL = 'jaakko.luttinen@iki.fi'
URL          = 'http://bayespy.org'
LICENSE      = 'MIT'
VERSION      = __version__


if __name__ == "__main__":

    import os
    import sys

    python_version = int(sys.version.split('.')[0])
    if python_version < 3:
        raise RuntimeError("BayesPy requires Python 3. You are running Python "
                           "{0}.".format(python_version))

    # Utility function to read the README file.
    # Used for the long_description.  It's nice, because now 1) we have a top level
    # README file and 2) it's easier to type in the README file than to put a raw
    # string in below ...
    def read(fname):
        return open(os.path.join(os.path.dirname(__file__), fname)).read()

    from setuptools import setup, find_packages
    
    # Setup for BayesPy
    setup(
        install_requires = [
            'numpy>=1.8.0', # 1.8 implements broadcasting in numpy.linalg
            'scipy>=0.13.0', # <0.13 have a bug in special.multigammaln
            'matplotlib>=1.2.0',
            'h5py'
        ],
        packages         = find_packages(),
        package_data     = {
            NAME: ["tests/baseline_images/test_plot/*.png"]
        },
        name             = NAME,
        version          = VERSION,
        author           = AUTHOR,
        author_email     = AUTHOR_EMAIL,
        description      = DESCRIPTION,
        license          = LICENSE,
        url              = URL,
        long_description = read('README.rst'),
        keywords         = [
            'variational Bayes',
            'probabilistic programming',
            'Bayesian networks',
            'graphical models',
            'variational message passing'
        ],
        classifiers = [ 
            'Programming Language :: Python :: 3 :: Only',
            'Programming Language :: Python :: 3.3',
            'Programming Language :: Python :: 3.4',
            'Development Status :: 4 - Beta',
            'Environment :: Console',
            'Intended Audience :: Developers',
            'Intended Audience :: Science/Research',
            'License :: OSI Approved :: MIT License',
            'Operating System :: OS Independent',
            'Topic :: Scientific/Engineering',
            'Topic :: Scientific/Engineering :: Information Analysis'
        ],
        entry_points = {
            'nose.plugins': [
                'warnaserror = bayespy.testing:WarnAsError',
            ]
        },
    )


@@ -439,16 +439,70 @@
 on = %7B%7D%0A
+base_dir = os.path.dirname(os.path.abspath(__file__))%0A
 with ope
@@ -516,16 +516,26 @@
 th.join(
+base_dir, 
 'bayespy

Fix version number fetching in setup.py