diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2012-11-24 09:09:52 +0100 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2012-11-24 09:09:52 +0100 |
| commit | 6e8276a8be8c63813ec1f371d670f1aaa25d525c (patch) | |
| tree | 6f3fc13e903daebf1728f908bfec80f9f50ecefa | |
| parent | fb91835f1884a526753b9b1eb70d6d0986c2c208 (diff) | |
| download | sqlparse-6e8276a8be8c63813ec1f371d670f1aaa25d525c.tar.gz | |
parse version number instead of importing sqlparse in setup.py
This allows to bootstrap the python 3 conversion process whithout failing on
python setup.py develop.
Patch with slight modifications by Florian Bauer.
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | CHANGES | 2 | ||||
| -rwxr-xr-x | setup.py | 40 |
4 files changed, 27 insertions, 17 deletions
@@ -4,6 +4,7 @@ dist MANIFEST .coverage .cache/ +*.egg-info/ htmlcov/ extras/appengine/sqlparse extras/appengine/lib/ @@ -4,6 +4,7 @@ This module contains code (namely the lexer and filter mechanism) from the pygments project that was written by Georg Brandl. Alphabetical list of contributors: +* Florian Bauer <florian.bauer@zmdi.com> * Mike Amy <cocoade@googlemail.com> * Jesús Leganés Combarro "Piranna" <piranna@gmail.com> * Kevin Jing Qiu <kevin.jing.qiu@gmail.com> @@ -3,6 +3,8 @@ Development Version Other * py3k fixes (by vthriller). + * py3k fixes in setup.py (by Florian Bauer). + * setup.py now requires distribute (by Florian Bauer). Release 0.1.5 (Nov 13, 2012) @@ -3,21 +3,24 @@ # This setup script is part of python-sqlparse and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php. -import os -from distutils.core import setup +import re +from setuptools import setup, find_packages -import sqlparse +def get_version(): + """parse __init__.py for version number instead of importing the file -def find_packages(base): - ret = [base] - for path in os.listdir(base): - if path.startswith('.'): - continue - full_path = os.path.join(base, path) - if os.path.isdir(full_path): - ret += find_packages(full_path) - return ret + see http://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package + """ + VERSIONFILE='sqlparse/__init__.py' + verstrline = open(VERSIONFILE, "rt").read() + VSRE = r'^__version__ = [\'"]([^\'"]*)[\'"]' + mo = re.search(VSRE, verstrline, re.M) + if mo: + return mo.group(1) + else: + raise RuntimeError('Unable to find version string in %s.' + % (VERSIONFILE,)) LONG_DESCRIPTION = """ @@ -71,17 +74,17 @@ Parsing:: """ - +VERSION = get_version() DOWNLOAD_URL = ( 'https://github.com/downloads/andialbrecht/sqlparse/' - 'sqlparse-%s.tar.gz' % sqlparse.__version__ + 'sqlparse-%s.tar.gz' % VERSION ) setup( name='sqlparse', - version=sqlparse.__version__, - packages=find_packages('sqlparse'), + version=VERSION, + packages=find_packages(), description='Non-validating SQL parser', author='Andi Albrecht', author_email='albrecht.andi@gmail.com', @@ -96,9 +99,12 @@ setup( 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.4', 'Programming Language :: Python :: 2.5', 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.2', + 'Programming Language :: Python :: 3.3', 'Topic :: Database', 'Topic :: Software Development' ], |
