use a specific release number for dev depending on git tag

This commit is contained in:
benoitc 2010-07-31 16:18:13 +02:00
parent 800637c192
commit 5108a720f2
2 changed files with 36 additions and 1 deletions

View File

@ -3,5 +3,24 @@
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
version_info = (0, 10, 0)
import os
if os.environ.get('release') != "true":
minor_tag = "-dev"
try:
from gunicorn.util import popen3
stdin, stdout, stderr = popen3("git rev-parse --short HEAD --")
error = stderr.read()
if not error:
minor_tag = ".%s-git" % stdout.read()
except OSError:
pass
else:
minor_tag = ""
version_info = (0, 10, "1%s" % minor_tag)
__version__ = ".".join(map(str, version_info))

View File

@ -14,6 +14,22 @@ import sys
import textwrap
import time
try:#python 2.6, use subprocess
import subprocess
subprocess.Popen # trigger ImportError early
closefds = os.name == 'posix'
def popen3(cmd, mode='t', bufsize=0):
p = subprocess.Popen(cmd, shell=True, bufsize=bufsize,
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
close_fds=closefds)
p.wait()
return (p.stdin, p.stdout, p.stderr)
except ImportError:
subprocess = None
popen3 = os.popen3
MAXFD = 1024
if (hasattr(os, "devnull")):
REDIRECT_TO = os.devnull