summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2012-11-24 09:09:52 +0100
committerAndi Albrecht <albrecht.andi@gmail.com>2012-11-24 09:09:52 +0100
commit6e8276a8be8c63813ec1f371d670f1aaa25d525c (patch)
tree6f3fc13e903daebf1728f908bfec80f9f50ecefa
parentfb91835f1884a526753b9b1eb70d6d0986c2c208 (diff)
downloadsqlparse-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--.gitignore1
-rw-r--r--AUTHORS1
-rw-r--r--CHANGES2
-rwxr-xr-xsetup.py40
4 files changed, 27 insertions, 17 deletions
diff --git a/.gitignore b/.gitignore
index e56f107..5ac5a7e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@ dist
MANIFEST
.coverage
.cache/
+*.egg-info/
htmlcov/
extras/appengine/sqlparse
extras/appengine/lib/
diff --git a/AUTHORS b/AUTHORS
index 5f95c1a..87f7587 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -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>
diff --git a/CHANGES b/CHANGES
index 154cb20..323306d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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)
diff --git a/setup.py b/setup.py
index 0355519..7421e34 100755
--- a/setup.py
+++ b/setup.py
@@ -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'
],