mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 07:18:27 +01:00
setup: change define __version__ (#2592)
* setup: change define __version__ * setup: run pre-commit install, black, adn flake8
This commit is contained in:
committed by
Ruslan Kuprieiev
parent
f254004fae
commit
711dc2ea9a
+1
-1
@@ -12,7 +12,7 @@ _BASE_VERSION = "0.62.0"
|
||||
|
||||
def _generate_version(base_version):
|
||||
"""Generate a version with information about the git repository"""
|
||||
pkg_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
pkg_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
if not _is_git_repo(pkg_dir) or not _have_git():
|
||||
return base_version
|
||||
|
||||
@@ -10,13 +10,20 @@ import fastentrypoints # noqa: F401
|
||||
|
||||
|
||||
# https://packaging.python.org/guides/single-sourcing-package-version/
|
||||
pkg_dir = os.path.dirname(__file__)
|
||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
version_path = os.path.join(pkg_dir, "dvc", "version.py")
|
||||
if sys.version_info[0] == 2:
|
||||
import imp
|
||||
|
||||
# This will define __version__ implicitly
|
||||
with open(os.path.join(pkg_dir, "dvc", "version.py")) as fobj:
|
||||
exec(fobj.read())
|
||||
dvc_version = imp.load_source("dvc.version", version_path)
|
||||
else:
|
||||
import importlib.util
|
||||
|
||||
version = __version__ # noqa: F821
|
||||
spec = importlib.util.spec_from_file_location("dvc.version", version_path)
|
||||
dvc_version = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(dvc_version)
|
||||
|
||||
version = dvc_version.__version__ # noqa: F821
|
||||
|
||||
|
||||
# To achieve consistency between the build version and the one provided
|
||||
|
||||
Reference in New Issue
Block a user