adds build code
This commit is contained in:
parent
8dc3d08c01
commit
791639bbe7
6 changed files with 64 additions and 0 deletions
1
build/.version
Normal file
1
build/.version
Normal file
|
|
@ -0,0 +1 @@
|
|||
1.0.0+build.1
|
||||
23
build/build.py
Normal file
23
build/build.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import os
|
||||
import shutil
|
||||
|
||||
import versioning
|
||||
|
||||
ZIP_FILE_NAME = "blender_bake-id-mask_{version}"
|
||||
|
||||
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
SOURCE_PATH = os.path.join(CURRENT_PATH, "../src")
|
||||
TARGET_PATH = os.path.join(CURRENT_PATH, '../dist')
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
if not os.path.isdir(TARGET_PATH):
|
||||
os.mkdir(TARGET_PATH)
|
||||
|
||||
currentVersion = versioning.get_version()
|
||||
nextVersion = currentVersion.bump_build()
|
||||
versioning.save_version(nextVersion)
|
||||
|
||||
filename = os.path.join(TARGET_PATH, ZIP_FILE_NAME.format(version=nextVersion.__str__()))
|
||||
shutil.make_archive(filename, 'zip', SOURCE_PATH)
|
||||
12
build/bump_major_version.py
Normal file
12
build/bump_major_version.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import os
|
||||
|
||||
import versioning
|
||||
|
||||
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||
CURRENT_VER_FILE = os.path.join(CURRENT_PATH, ".version")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
currentVersion = versioning.get_version()
|
||||
nextVersion = currentVersion.bump_major()
|
||||
versioning.save_version(nextVersion)
|
||||
8
build/bump_minor.py
Normal file
8
build/bump_minor.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import versioning
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
currentVersion = versioning.get_version()
|
||||
nextVersion = currentVersion.bump_minor()
|
||||
versioning.save_version(nextVersion)
|
||||
|
||||
19
build/versioning.py
Normal file
19
build/versioning.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import os
|
||||
|
||||
import semver
|
||||
|
||||
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||
CURRENT_VER_FILE = os.path.join(CURRENT_PATH, ".version")
|
||||
|
||||
|
||||
def get_version():
|
||||
if not os.path.isfile(CURRENT_VER_FILE):
|
||||
return semver.Version.parse('1.0.0')
|
||||
with open(CURRENT_VER_FILE) as f:
|
||||
content = f.read()
|
||||
return semver.Version.parse(content)
|
||||
|
||||
|
||||
def save_version(version: semver.Version):
|
||||
with open(CURRENT_VER_FILE, 'w') as f:
|
||||
f.write(version.__str__())
|
||||
Loading…
Add table
Add a link
Reference in a new issue