Skip to content

Commit

Permalink
In setup.py, get version without loading the whole textile package.
Browse files Browse the repository at this point in the history
Loading the package in setup.py is unnecessary,
and will fail if dependencies are not installed yet.
  • Loading branch information
rczajka committed Sep 18, 2014
1 parent d83478f commit ad503b6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
13 changes: 10 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from setuptools import setup, find_packages
import os
import sys

from textile import __version__

install_requires = []

try:
Expand All @@ -15,9 +14,17 @@
'tox',
])

def get_version():
basedir = os.path.dirname(__file__)
with open(os.path.join(basedir, 'textile/version.py')) as f:
VERSION = None
exec(f.read())
return VERSION
raise RuntimeError('No version info found.')

setup(
name='textile',
version=__version__,
version=get_version(),
description='Textile processing for python.',
url='http://github.com/ikirudennis/python-textile',
packages=find_packages(),
Expand Down
3 changes: 2 additions & 1 deletion textile/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .core import textile, textile_restricted, Textile
from .version import VERSION

__all__ = ['textile', 'textile_restricted']

__version__ = '2.1.8'
__version__ = VERSION
1 change: 1 addition & 0 deletions textile/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION = '2.1.8'

0 comments on commit ad503b6

Please sign in to comment.