changeset 30:ffcce6062bee

Put the version number info the optinal common module _cutils.py
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 07 Dec 2020 09:30:53 +0100
parents c06e438f68b2
children 7af20e752600
files _cutils.py setup.py shasum.py
diffstat 3 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/_cutils.py	Mon Dec 07 09:30:53 2020 +0100
@@ -0,0 +1,15 @@
+r"""
+:Author:    Franz Glasner
+:Copyright: (c) 2020 Franz Glasner.
+            All rights reserved.
+:License:   BSD 3-Clause "New" or "Revised" License.
+            See :ref:`LICENSE <license>` for details.
+            If you cannot find LICENSE see
+            <https://opensource.org/licenses/BSD-3-Clause>
+:ID:        @(#) $HGid$
+
+"""
+
+__version__ = "0.1"
+
+__all__ = ["__version__"]
--- a/setup.py	Mon Dec 07 03:10:44 2020 +0100
+++ b/setup.py	Mon Dec 07 09:30:53 2020 +0100
@@ -20,7 +20,7 @@
 _version_re = re.compile(br"^\s*__version__\s*=\s*(\"|')(.*)\1\s*(#.*)?$",
                          re.MULTILINE)
 
-with open(os.path.join(pkg_root, "shasum.py"), "rb") as vf:
+with open(os.path.join(pkg_root, "_cutils.py"), "rb") as vf:
     version = _version_re.search(vf.read()).group(2).decode("utf-8")
 
 
@@ -32,7 +32,8 @@
     url="https://pypi.dom66.de/simple/py-cutils/",
     description="Pure Python implementation of some coreutils",
     long_description="Pure Python implementation of some coreutils",
-    py_modules=["shasum"],
+    py_modules=["_cutils",
+                "shasum",],
     include_package_data=False,
     zip_safe=True,
     platforms="any",
--- a/shasum.py	Mon Dec 07 03:10:44 2020 +0100
+++ b/shasum.py	Mon Dec 07 09:30:53 2020 +0100
@@ -13,7 +13,10 @@
 from __future__ import print_function
 
 
-__version__ = "0.1"
+try:
+    from _cutils import __version__
+except ImportError:
+    __version__ = "unknown"
 
 __revision__ = "|VCSRevision|"
 __date__ = "|VCSJustDate|"