#!/usr/bin/env python

from setuptools import setup
import os.path
import subprocess

def readme():
    with open("README.rst", "r") as f:
        return f.read()

def get_version():
    try:
        return subprocess.check_output(["git", "describe"]).rstrip().decode("utf-8")
    except subprocess.CalledProcessError:
        return "0.0"  # no tag set, default to 0.0

setup(
    name="h5sh",
    version="{}".format(get_version()),
    description="An interactive shell for HDF5 files",
    long_description=readme(),
    keywords="h5sh hdf5 h5 shell",
    url="https://github.com/jl-wynen/h5shell",
    author="Jan-Lukas Wynen",
    author_email="j-l.wynen@hotmail.de",
    license="MIT",
    packages=["h5sh", "h5sh/commands"],
    entry_points={
        "console_scripts": ["h5sh=h5sh.command_line:main"]
    },
    requires=["h5py"],
    extras_require={
        "psutil": ["psutil"],
        "rtd_theme": ["sphinx_rtd_theme"]
    },
    include_package_data=True,
    zip_safe=False
)

@@ -49,23 +49,8 @@
 tup%0A
-import os.path%0A
 impo
@@ -63,16 +63,16 @@
 process%0A
+
 %0Adef rea
@@ -170,25 +170,24 @@
    t
-ry:%0A        retur
+ags = %5Be for e i
 n su
@@ -221,91 +221,99 @@
 %22, %22
-describe%22%5D).rstrip().decode(%22utf-8%22)%0A    except subprocess.CalledProcessError:%0A    
+tag%22%5D).decode(%22utf-8%22).split(%22%5Cn%22)%0A            if e%5D%0A    if tags:%0A        return tags%5B-1%5D%0A%0A
     
@@ -335,19 +335,21 @@
  no tag 
-set
+found
 , defaul
@@ -353,19 +353,28 @@
 ault to 
-0.0
+'no version'
 %0A%0Asetup(

Fix reading git tag