summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>2010-05-26 02:01:55 +0200
committerRonny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>2010-05-26 02:01:55 +0200
commit576ba8470e3636eadf21823154a6164748f0a554 (patch)
tree012fba1c04cc00d9ffe3d6011638e2f941f02715
parent5ab74c436d1b35f27b271d072e851a5b10878d8e (diff)
downloadsetuptools-scm-576ba8470e3636eadf21823154a6164748f0a554.tar.gz
move docs to README.txt0.3
-rw-r--r--README.txt28
-rw-r--r--hgdistver.py21
-rw-r--r--setup.py2
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:
diff --git a/setup.py b/setup.py
index 6a0926f..c561cfc 100644
--- a/setup.py
+++ b/setup.py
@@ -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',