mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
use a specific release number for dev depending on git tag
This commit is contained in:
parent
800637c192
commit
5108a720f2
@ -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))
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user