Skip to content

Commit

Permalink
prepare release py
Browse files Browse the repository at this point in the history
  • Loading branch information
jginternational committed May 31, 2024
1 parent 16da9e8 commit dc1d3c0
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/create-release.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Expand Down
43 changes: 43 additions & 0 deletions tools/prepare-release-files.py
Original file line number Diff line number Diff line change
@@ -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)


0 comments on commit dc1d3c0

Please sign in to comment.