2018-07-12 23:19:32 +02:00
|
|
|
#
|
|
|
|
# This set the version using git. useful when building with cx_freeze
|
|
|
|
#
|
|
|
|
import re
|
|
|
|
import subprocess
|
2019-08-25 00:27:31 +02:00
|
|
|
|
2018-07-12 23:19:32 +02:00
|
|
|
cmd = ["git", "describe", "--tags", "--dirty", "--always"]
|
|
|
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
|
|
|
|
stdout, stderr = p.communicate()
|
|
|
|
version = stdout.decode().strip()
|
|
|
|
|
|
|
|
initfile = "lib/svtplay_dl/__init__.py"
|
|
|
|
with open(initfile) as fd:
|
|
|
|
data = fd.read()
|
|
|
|
|
2021-02-28 22:05:15 +01:00
|
|
|
newstring = re.sub("(__version__ = get_version[^\n]+)", f'__version__ = "{version}"', data)
|
2023-11-26 22:07:23 +01:00
|
|
|
with open(initfile, "w") as fd:
|
2018-07-12 23:19:32 +02:00
|
|
|
fd.write(newstring)
|