Commit 17bbb86d authored by Marcel Rieger's avatar Marcel Rieger

Improve reading package info during setup.

parent e1b9c61b
...@@ -19,9 +19,8 @@ __all__ = ["LBN", "FeatureFactoryBase", "FeatureFactory"] ...@@ -19,9 +19,8 @@ __all__ = ["LBN", "FeatureFactoryBase", "FeatureFactory"]
import os import os
import functools import functools
if os.environ.get("LBN_SETUP_RUNNING") != "1": import numpy as np
import numpy as np import tensorflow as tf
import tensorflow as tf
class LBN(object): class LBN(object):
......
...@@ -4,9 +4,6 @@ ...@@ -4,9 +4,6 @@
import os import os
import setuptools import setuptools
os.environ["LBN_SETUP_RUNNING"] = "1"
import lbn
this_dir = os.path.dirname(os.path.abspath(__file__)) 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: ...@@ -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: with open(os.path.join(this_dir, "requirements.txt"), "r") as f:
install_requires = [line.strip() for line in f.readlines() if line.strip()] 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( setuptools.setup(
name=lbn.__name__, name="lbn",
version=lbn.__version__, version=pkg["__version__"],
author=lbn.__author__, author=pkg["__author__"],
author_email=lbn.__email__, author_email=pkg["__email__"],
description=lbn.__doc__.strip().split("\n")[0].strip(), description=pkg["__doc__"].strip().split("\n")[0].strip(),
license=lbn.__license__, license=pkg["__license__"],
url=lbn.__contact__, url=pkg["__contact__"],
keywords=keywords, keywords=keywords,
classifiers=classifiers, classifiers=classifiers,
long_description=long_description, long_description=long_description,
...@@ -50,6 +55,6 @@ setuptools.setup( ...@@ -50,6 +55,6 @@ setuptools.setup(
install_requires=install_requires, install_requires=install_requires,
python_requires=">=2.7", python_requires=">=2.7",
zip_safe=False, zip_safe=False,
py_modules=[lbn.__name__], py_modules=["lbn"],
data_files=[(".", ["LICENSE", "requirements.txt", "README.md"])], data_files=[(".", ["LICENSE", "requirements.txt", "README.md"])],
) )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment