diff --git a/lbn.py b/lbn.py index 11b07f4e2e7187dcfcaf2ee864aa8066ea89c690..0e31643f352163942588db8508ee2e5f354338f8 100644 --- a/lbn.py +++ b/lbn.py @@ -19,9 +19,8 @@ __all__ = ["LBN", "FeatureFactoryBase", "FeatureFactory"] import os import functools -if os.environ.get("LBN_SETUP_RUNNING") != "1": - import numpy as np - import tensorflow as tf +import numpy as np +import tensorflow as tf class LBN(object): diff --git a/setup.py b/setup.py index 3e0673852cf3794f84b595ea35fe7bc973950efb..d02f487ee8dcff9ed3abc42010eac265b2338b24 100644 --- a/setup.py +++ b/setup.py @@ -4,9 +4,6 @@ import os import setuptools -os.environ["LBN_SETUP_RUNNING"] = "1" -import lbn - this_dir = os.path.dirname(os.path.abspath(__file__)) @@ -35,14 +32,22 @@ with open(os.path.join(this_dir, "README.md"), "r") as f: with open(os.path.join(this_dir, "requirements.txt"), "r") as f: install_requires = [line.strip() for line in f.readlines() if line.strip()] +# load package infos +pkg = {} +with open(os.path.join(this_dir, "lbn.py"), "r") as f: + # read until lines up to the __version__ info + lines = f.readlines() + end = [i for i, l in enumerate(lines) if l.startswith("__version__")][0] + 1 + exec("".join(lines[:end]), pkg) + setuptools.setup( - name=lbn.__name__, - version=lbn.__version__, - author=lbn.__author__, - author_email=lbn.__email__, - description=lbn.__doc__.strip().split("\n")[0].strip(), - license=lbn.__license__, - url=lbn.__contact__, + name="lbn", + version=pkg["__version__"], + author=pkg["__author__"], + author_email=pkg["__email__"], + description=pkg["__doc__"].strip().split("\n")[0].strip(), + license=pkg["__license__"], + url=pkg["__contact__"], keywords=keywords, classifiers=classifiers, long_description=long_description, @@ -50,6 +55,6 @@ setuptools.setup( install_requires=install_requires, python_requires=">=2.7", zip_safe=False, - py_modules=[lbn.__name__], + py_modules=["lbn"], data_files=[(".", ["LICENSE", "requirements.txt", "README.md"])], )