diff --git a/setup.py b/setup.py index 8cd10df8..19c09ede 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ class uWSGIDistribution(Distribution): setup(name='uWSGI', - version='0.9.8-dev', + version=uc.uwsgi_version, description='The uWSGI server', author='Unbit', author_email='info@unbit.it', diff --git a/uwsgi.h b/uwsgi.h index 61518d26..71c292f1 100644 --- a/uwsgi.h +++ b/uwsgi.h @@ -2,8 +2,6 @@ /* indent -i8 -br -brs -brf -l0 -npsl -nip -npcs -npsl -di1 */ -#define UWSGI_VERSION "0.9.8-dev" - #define UMAX16 65536 #define uwsgi_error(x) uwsgi_log("%s: %s [%s line %d]\n", x, strerror(errno), __FILE__, __LINE__); diff --git a/uwsgiconfig.py b/uwsgiconfig.py index 84ee6acb..aab7ffa1 100644 --- a/uwsgiconfig.py +++ b/uwsgiconfig.py @@ -1,5 +1,7 @@ # uWSGI build system +uwsgi_version = '0.9.8-dev' + import os import re import time @@ -23,6 +25,8 @@ GCC = os.environ.get('CC', sysconfig.get_config_var('CC')) if not GCC: GCC = 'gcc' + + def spcall(cmd): p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,stderr=open('/dev/null','w')) @@ -34,6 +38,12 @@ def spcall(cmd): else: return None +if uwsgi_version.endswith('-dev') and os.path.exists('%s/.hg' % os.path.dirname(os.path.abspath( __file__ ))): + try: + uwsgi_version += spcall('hg tip --template "-{rev}"') + except: + pass + def spcall2(cmd): p = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE) @@ -166,7 +176,7 @@ class uConf(object): if uwsgi_os == 'Linux': self.gcc_list.append('lib/linux_ns') self.gcc_list.append('lib/netlink') - self.cflags = ['-O2', '-Wall', '-Werror', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64'] + os.environ.get("CFLAGS", "").split() + self.cflags = ['-DUWSGI_VERSION="\\"' + uwsgi_version + '\\""', '-O2', '-Wall', '-Werror', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64'] + os.environ.get("CFLAGS", "").split() try: gcc_version = str(spcall("%s -dumpversion" % GCC)) except: