summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Alla <bruno.alla@founders4schools.org.uk>2017-01-15 14:59:49 +0000
committerBruno Alla <bruno.alla@founders4schools.org.uk>2017-01-15 14:59:49 +0000
commit76cbf9fadf1045aca779ce6bd5fb1140c1736965 (patch)
tree0e41f03ab3f4e0e050866604c79ef697aaddf766
parenta93f93a458f6ab3ce48439d2d571e4f88da4c024 (diff)
downloadtablib-76cbf9fadf1045aca779ce6bd5fb1140c1736965.tar.gz
Read version in setup.py without importing tablib
-rwxr-xr-xsetup.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/setup.py b/setup.py
index 2191a0e..f8c559f 100755
--- a/setup.py
+++ b/setup.py
@@ -2,16 +2,14 @@
# -*- coding: utf-8 -*-
import os
+import re
import sys
-import tablib
-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
-
if sys.argv[-1] == 'publish':
os.system("python setup.py sdist upload")
sys.exit()
@@ -64,9 +62,13 @@ install = [
'unicodecsv',
]
+with open('tablib/core.py', 'r') as fd:
+ version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
+ fd.read(), re.MULTILINE).group(1)
+
setup(
name='tablib',
- version=tablib.__version__,
+ version=version,
description='Format agnostic tabular data library (XLS, JSON, YAML, CSV)',
long_description=(open('README.rst').read() + '\n\n' +
open('HISTORY.rst').read()),