Merge pull request #6 from qiboteam/refactor_version_info
Move the version info into __init__.py
This commit is contained in:
17
setup.py
17
setup.py
@@ -5,14 +5,29 @@ import re
|
|||||||
|
|
||||||
PACKAGE = "qibotn"
|
PACKAGE = "qibotn"
|
||||||
|
|
||||||
|
|
||||||
|
# Returns the qibotn version
|
||||||
|
def get_version():
|
||||||
|
""" Gets the version from the package's __init__ file
|
||||||
|
if there is some problem, let it happily fail """
|
||||||
|
VERSIONFILE = os.path.join("src", PACKAGE, "__init__.py")
|
||||||
|
initfile_lines = open(VERSIONFILE, "rt").readlines()
|
||||||
|
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
|
||||||
|
for line in initfile_lines:
|
||||||
|
mo = re.search(VSRE, line, re.M)
|
||||||
|
if mo:
|
||||||
|
return mo.group(1)
|
||||||
|
|
||||||
|
|
||||||
# load long description from README
|
# load long description from README
|
||||||
this_directory = os.path.abspath(os.path.dirname(__file__))
|
this_directory = os.path.abspath(os.path.dirname(__file__))
|
||||||
with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f:
|
with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f:
|
||||||
long_description = f.read()
|
long_description = f.read()
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="qibotn",
|
name="qibotn",
|
||||||
version="0.1",
|
version=get_version(),
|
||||||
description="A tensor-network translation module for quantum computing",
|
description="A tensor-network translation module for quantum computing",
|
||||||
author="The Qibo team",
|
author="The Qibo team",
|
||||||
author_email="",
|
author_email="",
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
__version__ = "0.1"
|
__version__ = "0.0.1.dev0"
|
||||||
|
|||||||
Reference in New Issue
Block a user