diff options
-rw-r--r-- | README.txt | 28 | ||||
-rw-r--r-- | hgdistver.py | 21 | ||||
-rw-r--r-- | setup.py | 2 |
3 files changed, 29 insertions, 22 deletions
diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..98b4963 --- /dev/null +++ b/README.txt @@ -0,0 +1,28 @@ +hgdistver +~~~~~~~~~ + +This module is a simple drop-in to support setup.py +in mercurial based projects. + +Its supposed to generate version numbers from mercurials metadata. + +it uses 4 stategies to archive its taks: + +1. try to directly ask hg for the metadata +2. try to infer it from the `.hg_archival.txt` file +3. try to use the cachefile if it exists +4. try to read the version from the 'PKG-INFO' file sdists contain + +the most simple usage is:: + + from setuptools import setup + from hgdistver import get_version + setup( + ..., + version=get_version(), + ..., + ) + +get_version takes the optional argument cachefile, +which causes it to store the version info in a python script instead +of abusing PKG-INFO from a sdist diff --git a/hgdistver.py b/hgdistver.py index 609379a..c7d1c2d 100644 --- a/hgdistver.py +++ b/hgdistver.py @@ -1,23 +1,5 @@ -""" - hgdistver - ~~~~~~~~~ - - This module is a simple drop-in to support setup.py - in mercurial based projects. - - Its supposed to generate version numbers from mercurials metadata - and optionally store them in a cache file which may be a text or python - - However using cachefiles is strongly suggested, - cause distutils/setuptools won't store version numbers in sdists. - - >>> from hgdistver import get_version - >>> version = get_version(cachefile='mypkg/__version__.py') -""" - import os - def version_from_cachefile(cachefile=None): if not cachefile: return @@ -34,7 +16,6 @@ def version_from_cachefile(cachefile=None): fd.close() return version - def version_from_hg_id(cachefile=None): """stolen logic from mercurials setup.py as well""" if os.path.isdir('.hg'): @@ -55,8 +36,6 @@ def version_from_hg_id(cachefile=None): version += time.strftime('%Y%m%d') return version - - def _archival_to_version(data): """stolen logic from mercurials setup.py""" if 'tag' in data: @@ -5,7 +5,7 @@ setup( version=hgdistver.get_version(), author_mail='Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>', description='utility lib to generate python package version infos from mercurial tags', - long_description=hgdistver.__doc__, + long_description=open('README.txt').read(), license='MIT', py_modules=[ 'hgdistver', |