Skip to content

Commit e81fb4d

Browse files
committed
Move __version__ to _version.py.
- Fixes installs with Django 1.5 in the environment. - Steal get_version in setup.py from elasticutils.
1 parent 7a5c6a0 commit e81fb4d

4 files changed

Lines changed: 26 additions & 7 deletions

File tree

CHANGES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Statsd Changelog
22
================
33

4+
Version 2.0.1
5+
-------------
6+
7+
- Fix install with Django 1.5 in the environment.
8+
9+
410
Version 2.0
511
-----------
612

setup.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1-
from setuptools import setup, find_packages
1+
import os
2+
import re
3+
from setuptools import find_packages, setup
4+
5+
6+
VERSIONFILE = os.path.join('statsd', '_version.py')
7+
VSRE = r'^__version__ = [\'"]([^\'"]*)[\'"]'
8+
9+
10+
def get_version():
11+
verstrline = open(VERSIONFILE, "rt").read()
12+
mo = re.search(VSRE, verstrline, re.M)
13+
if mo:
14+
return mo.group(1)
15+
else:
16+
raise RuntimeError(
17+
"Unable to find version string in %s." % VERSIONFILE)
218

3-
import statsd
419

520
setup(
621
name='statsd',
7-
version=statsd.__version__,
22+
version=get_version(),
823
description='A simple statsd client.',
924
long_description=open('README.rst').read(),
1025
author='James Socol',

statsd/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@
88
settings = None
99

1010
from .client import StatsClient
11+
from ._version import __version__
1112

1213

1314
__all__ = ['StatsClient', 'statsd']
1415

15-
VERSION = (2, 0, 0)
16-
__version__ = '.'.join(map(str, VERSION))
17-
18-
1916
statsd = None
2017

2118
if settings:

statsd/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '2.0.1'

0 commit comments

Comments
 (0)