From 63573cdaefe3a2b98ece87e19d9ceb18f00bc0d9 Mon Sep 17 00:00:00 2001 From: Todd DeLuca Date: Mon, 21 May 2012 15:12:09 -0400 Subject: [PATCH 1/2] Remove package import for version to fix install. A common way to break project installation is to import the package in setup.py in order to get access to mypackage.__version__. However if mypackage depends on a different uninstalled package, the import will fail, causing setup.py to fail before it has a chance to install the dependency. The fix is to find some other DRY way to get at __version__. For more details see: - http://stackoverflow.com/questions/458550/ - http://stackoverflow.com/questions/2058802/ --- happybase/version.py | 4 ++++ setup.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 happybase/version.py diff --git a/happybase/version.py b/happybase/version.py new file mode 100644 index 0000000..0f127c0 --- /dev/null +++ b/happybase/version.py @@ -0,0 +1,4 @@ + +# package version for user in __init__.py and setup.py +__version__ = '0.1' + diff --git a/setup.py b/setup.py index c8aa11c..4c33f99 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,10 @@ from os.path import join, dirname from setuptools import find_packages, setup -import happybase +execfile('happybase/version.py') setup(name='happybase', - version=happybase.__version__, + version=__version__, description="A developer-friendly Python library to interact " "with Apache HBase", long_description=open(join(dirname(__file__), 'README.rst')).read(), From 5366974acea25ff25cd4c6ce85f6fcd42cf00795 Mon Sep 17 00:00:00 2001 From: Todd DeLuca Date: Mon, 21 May 2012 15:24:22 -0400 Subject: [PATCH 2/2] Use happybase.version in __init__ to stay DRY. --- happybase/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/happybase/__init__.py b/happybase/__init__.py index bc58455..4ca4320 100644 --- a/happybase/__init__.py +++ b/happybase/__init__.py @@ -2,6 +2,6 @@ HappyBase, a pythonic interface for HBase using Thrift """ -__version__ = '0.1' +from .version import __version__ from .api import *