Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed setup.py by not importing pyes, fixes #155

  • Loading branch information...
commit df7da4f73572959cd0e1de3b5714f28d0b1c282f 1 parent 1d1e7c6
@EnTeQuAk EnTeQuAk authored
Showing with 39 additions and 5 deletions.
  1. +39 −5 setup.py
View
44 setup.py
@@ -14,7 +14,41 @@
from setuptools import setup, find_packages, Command
from setuptools.command.test import test as TestCommand
-import pyes as distmeta
+# Extract distribution meta values, hint taken from Celery <http://celeryproject.org>
+
+import re
+re_meta = re.compile(r'__(\w+?)__\s*=\s*(.*)')
+re_vers = re.compile(r'VERSION\s*=\s*\((.*?)\)')
+re_doc = re.compile(r'^"""(.+?)"""')
+rq = lambda s: s.strip("\"'")
+
+def add_default(m):
+ attr_name, attr_value = m.groups()
+ return ((attr_name, rq(attr_value)), )
+
+
+def add_version(m):
+ v = list(map(rq, m.groups()[0].split(", ")))
+ return (("VERSION", ".".join(v[0:3]) + "".join(v[3:])), )
+
+
+def add_doc(m):
+ return (("doc", m.groups()[0]), )
+
+pats = {re_meta: add_default,
+ re_vers: add_version,
+ re_doc: add_doc}
+here = os.path.abspath(os.path.dirname(__file__))
+meta_fh = open(os.path.join(here, "pyes/__init__.py"))
+try:
+ meta = {}
+ for line in meta_fh:
+ for pattern, handler in pats.items():
+ m = pattern.match(line.strip())
+ if m:
+ meta.update(handler(m))
+finally:
+ meta_fh.close()
class QuickRunTests(TestCommand):
@@ -53,11 +87,11 @@ def run(self, *args, **kwargs):
setup(
name='pyes',
- version=distmeta.__version__,
+ version=meta['VERSION'],
description="Python Elastic Search driver",
- author=distmeta.__author__,
- author_email=distmeta.__contact__,
- url=distmeta.__homepage__,
+ author=meta['author'],
+ author_email=meta['contact'],
+ url=meta['homepage'],
platforms=["any"],
license="BSD",
packages=find_packages(exclude=['ez_setup', 'tests', 'tests.*', "docs.*"]),
Please sign in to comment.
Something went wrong with that request. Please try again.