import os\r
from distutils.core import setup\r
\r
+\r
+# Figure out the version; this could be done by importing the\r
+# module, though that requires Django to be already installed,\r
+# which may not be the case when processing a pip requirements\r
+# file, for example.\r
+import re\r
+here = os.path.dirname(os.path.abspath(__file__))\r
+version_re = re.compile(\r
+ r'__version__ = (\(.*?\))')\r
+fp = open(os.path.join(here, 'django_tables', '__init__.py'))\r
+version = None\r
+for line in fp:\r
+ match = version_re.search(line)\r
+ if match:\r
+ version = eval(match.group(1))\r
+ break\r
+else:\r
+ raise Exception("Cannot find version in __init__.py")\r
+fp.close()\r
+\r
+\r
def find_packages(root):\r
# so we don't depend on setuptools; from the Storm ORM setup.py\r
packages = []\r
packages.append(directory.replace(os.sep, '.'))\r
return packages\r
\r
+\r
setup(\r
name = 'django-tables',\r
- version = '0.1',\r
+ version=".".join(map(str, version)),\r
description = 'Render QuerySets as tabular data in Django.',\r
author = 'Michael Elsdoerfer',\r
author_email = 'michael@elsdoerfer.info',\r