From e966f5d9169bb83fc6591960949fa1361e864c87 Mon Sep 17 00:00:00 2001 From: William Cooke Date: Thu, 19 Jun 2014 12:11:39 +0100 Subject: [PATCH] Fix setup.py to not attempt importing uninstalled libraries. --- setup.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 0a88847..bbac8a1 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,24 @@ #!/usr/bin/env python #from distutils.core import setup +import re from setuptools import setup, find_packages -from tweepy import __version__ from pip.req import parse_requirements +VERSIONFILE = "tweepy/__init__.py" +ver_file = open(VERSIONFILE, "rt").read() +VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]" +mo = re.search(VSRE, ver_file, re.M) + +if mo: + version = mo.group(1) +else: + raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,)) + install_reqs = parse_requirements('requirements.txt') reqs = [str(req.req) for req in install_reqs] setup(name="tweepy", - version=__version__, + version=version, description="Twitter library for python", license="MIT", author="Joshua Roesslein", -- 2.25.1