Use the ast module instead of a jedi import to get the jedi version.

With dependencies it's not possible to do this with importing jedi anymore. It's now just a bit more complicated. Gosh I hate setup.py.
This commit is contained in:
Dave Halter
2017-05-20 17:53:11 -04:00
parent c7984c0710
commit d6f695b3bb

View File

@@ -2,19 +2,24 @@
from setuptools import setup from setuptools import setup
import jedi import ast
__AUTHOR__ = 'David Halter' __AUTHOR__ = 'David Halter'
__AUTHOR_EMAIL__ = 'davidhalter88@gmail.com' __AUTHOR_EMAIL__ = 'davidhalter88@gmail.com'
# Get the version from within jedi. It's defined in exactly one place now.
with open('jedi/__init__.py') as f:
tree = ast.parse(f.read())
version = tree.body[1].value.s
readme = open('README.rst').read() + '\n\n' + open('CHANGELOG.rst').read() readme = open('README.rst').read() + '\n\n' + open('CHANGELOG.rst').read()
packages = ['jedi', 'jedi.evaluate', 'jedi.evaluate.compiled', 'jedi.api'] packages = ['jedi', 'jedi.evaluate', 'jedi.evaluate.compiled', 'jedi.api']
with open('requirements.txt') as f: with open('requirements.txt') as f:
install_requires = f.read().splitlines() install_requires = f.read().splitlines()
setup(name='jedi', setup(name='jedi',
version=jedi.__version__, version=version,
description='An autocompletion tool for Python that can be used for text editors.', description='An autocompletion tool for Python that can be used for text editors.',
author=__AUTHOR__, author=__AUTHOR__,
author_email=__AUTHOR_EMAIL__, author_email=__AUTHOR_EMAIL__,