Commits

Lynn Rees committed 77a4c8a

- better setup through versioning

  • Participants
  • Parent commits 1fb0868

Comments (0)

Files changed (4)

 sphinxup = './setup.py upload_sphinx'
 
 
+def getversion(fname):
+    '''
+    Get the __version__ without importing.
+    '''
+    for line in open(fname):
+        if line.startswith('__version__'):
+            return '%s.%s.%s' % eval(line[13:])
+
+
 def _promptup():
     prompt('Enter tag: ', 'tag')
     with settings(warn_only=True):
-        local('hg tag "%(tag)s"' % env)
+        local('hg tag "%(tag)s"' % getversion('knife/__init__.py'))
         local('hg push ssh://hg@bitbucket.org/lcrees/knife')
         local('hg push github')
 

knife/__init__.py

 __ = lazyknife
 
 __all__ = ('knife', 'activeknife', 'lazyknife', '__')
+
+__version__ = (0, 5, 6)

knife/version.py

-# -*- coding: utf-8 -*-
-
-__version__ = (0, 5, 6)
 from setuptools import setup, find_packages
 
 
+def getversion(fname):
+    '''
+    Get the __version__ without importing.
+    '''
+    for line in open(fname):
+        if line.startswith('__version__'):
+            return '%s.%s.%s' % eval(line[13:])
+
 setup(
     name='knife',
-    version='0.5.6',
+    version=getversion('knife/__init__.py'),
     description='Pythonic remix of underscore.js: Things go in. Things get '
         'knifed. Things go out.',
     long_description=open(join(getcwd(), 'README.rst'), 'r').read(),