dvc: refactor package versioning logic

- Use `version.py` to compute a dynamic version stored in `__version__`.
  Version information was scattered across the source code
  (`VERSION_BASE`, `VERSION`, `__version__`, and `version.py`).

- Read `__version__` from `setup.py` and **pin** it using custom
  `build_py` command class.
  This way, we can maintain consistancy between the build version
  and the runtime one.
  Also, this gives us the ability to run `setup.py` without depending on
  on `dvc` itself.

Close #1824
This commit is contained in:
Mr. Outis
2019-04-06 18:06:11 -06:00
parent 2699a47f3e
commit b4d0d37ac8
11 changed files with 108 additions and 95 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ command_exists()
fpm_build()
{
print_info "Building $1..."
VERSION=$(python -c "import dvc; from dvc import VERSION; print(str(VERSION))")
VERSION=$(python -c "import dvc; from dvc import __version__; print(str(__version__))")
fpm -s dir \
-f \
-t $1 \
+2 -2
View File
@@ -1,10 +1,10 @@
# This script generates config.ini for setup.iss script
from dvc import VERSION
from dvc import __version__
from dvc.utils.compat import ConfigParser
config = ConfigParser.ConfigParser()
config.add_section("Version")
config.set("Version", "Version", VERSION)
config.set("Version", "Version", __version__)
with open("scripts/innosetup/config.ini", "w") as f:
config.write(f)