diff --git a/tools/create-release.bat b/tools/create-release.bat index 73e20693c..842574d45 100644 --- a/tools/create-release.bat +++ b/tools/create-release.bat @@ -5,6 +5,11 @@ set VERSION=9.5.1 @REM set BRANCH=Release-%VERSION% @REM git branch %BRANCH% @REM git checkout %BRANCH% + + +@REM run python prepare-release-files.py +python prepare-release-files.py + cd .. mkdir dist set FOLDER=dist\kratos-%VERSION% diff --git a/tools/prepare-release-files.py b/tools/prepare-release-files.py new file mode 100644 index 000000000..fed9e1104 --- /dev/null +++ b/tools/prepare-release-files.py @@ -0,0 +1,43 @@ +# read the file kratos_default.spd, and parse it as xml +# then extract the version number + +import xml.etree.ElementTree as ET +import sys + +def get_version_number(file_name): + tree = ET.parse(file_name) + root = tree.getroot() + version = root.find('version').text + return version + +if __name__ == "__main__": + + file_name = "../kratos.gid/kratos_default.spd" + version = get_version_number(file_name) + print(version) + + # Get all the applications whose tag is appLink + tree = ET.parse(file_name) + root = tree.getroot() + applications = root.findall('.//appLink') + # create a list of applications, reading the field 'n' + + app_list = [] + for app in applications: + app_list.append(app.attrib['n']) + + print(app_list) + # if there is a folder in the folder apps whose name is not in the list, delete it + + folder_name = "../kratos.gid/apps" + import os + for folder in os.listdir(folder_name): + if folder not in app_list: + print("Deleting folder: ", folder) + import shutil + shutil.rmtree(folder_name + "/" + folder) + + # Ready + print("Ready to release version: ", version) + + \ No newline at end of file