#!/usr/bin/env python2
# vim: set ts=4 sw=4 expandtab sts=4 fileencoding=utf-8:

import os
import string
import subprocess
import warnings

MAJOR = 0
MINOR = 6
PATCH = 0

RELEASE = False

VERSION = "{0}.{1}.{2}".format(MAJOR, MINOR, PATCH)

if not RELEASE:
    try:
        try:
            pipe = subprocess.Popen(
                ["git", "describe", "--always", "--dirty", "--tags"],
                stdout=subprocess.PIPE)
        except EnvironmentError:
            warnings.warn("WARNING: git not installed or failed to run")

        revision = pipe.communicate()[0].strip().lstrip('v')
        if pipe.returncode != 0:
            warnings.warn("WARNING: couldn't get git revision")

        if revision != VERSION:
            revision = revision.lstrip(string.digits + '.')
            VERSION += '.dev' + revision
    except:
        VERSION += '.dev'
        warnings.warn("WARNING: git not installed or failed to run")


def write_version():
    """writes the khal/version.py file"""
    template = """\
__version__ = '{0}'
"""
    filename = os.path.join(
        os.path.dirname(__file__), 'khal', 'version.py')
    with open(filename, 'w') as versionfile:
        versionfile.write(template.format(VERSION))

@@ -263,25 +263,8 @@
 ry:%0A
-        try:%0A    
     
@@ -304,20 +304,16 @@
         
- 
-   
 %5B%22git%22, 
@@ -370,20 +370,16 @@
         
-    
 stdout=s
@@ -397,114 +397,8 @@
 IPE)
-%0A        except EnvironmentError:%0A            warnings.warn(%22WARNING: git not installed or failed to run%22)
 %0A%0A  
@@ -436,16 +436,25 @@
 te()%5B0%5D.
+decode().
 strip().
@@ -708,16 +708,71 @@
 except:%0A
+        import traceback%0A        traceback.print_exc()%0A
         

Print traceback, fix Py3 support