Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / msicreator / create_installer.py
blob01394a48c4a32ed20f41315717794c4fb0b6e559
1 import os, sys
2 from shutil import copytree, copy2, move, rmtree
3 import json
4 import createmsi
6 build_dir = sys.argv[1]
7 src_dir = sys.argv[2]
8 creator_dir = os.path.join(build_dir, 'workdir/installation/MSICreatorLO')
10 def prepare_project_dir():
11 instdir = os.path.join(build_dir, 'instdir')
12 fonts_dir = os.path.join(instdir, 'share/fonts')
13 new_fonts_dir = os.path.join(creator_dir, 'libo-fonts/share/fonts')
14 main_dir = os.path.join(creator_dir, 'main')
15 src_uninstaller_icon = os.path.join(src_dir, 'icon-themes/colibre/res/mainapp_48_8.png')
16 src_ui_banner = os.path.join(src_dir, 'instsetoo_native/inc_common/windows/msi_templates/Binary/Banner.bmp')
17 src_ui_background = os.path.join(src_dir, 'instsetoo_native/inc_common/windows/msi_templates/Binary/Image_2.bmp')
18 graphics_dir = os.path.join(creator_dir, 'graphics')
19 sdk_dir = os.path.join(creator_dir, 'main/sdk')
20 try:
21 move(fonts_dir, new_fonts_dir)
22 copytree(instdir, main_dir, dirs_exist_ok=True)
23 copy2(src_uninstaller_icon, creator_dir)
24 os.mkdir(graphics_dir)
25 copy2(src_ui_banner, graphics_dir)
26 copy2(src_ui_background, graphics_dir)
27 rmtree(sdk_dir)
28 except FileExistsError as err:
29 print(err)
31 def create_creator_json():
32 lo_version = sys.argv[3]
33 lo_name = sys.argv[4]
34 uninstaller_icon = 'mainapp_48_8.png'
35 lo_dictionary = {
36 "upgrade_guid": "6f05ed48-a735-4155-ab60-e4cc98455262",
37 "version": lo_version,
38 "product_name": lo_name,
39 "manufacturer": "The Document Foundation",
40 "name": lo_name,
41 "name_base": lo_name,
42 "comments": "Testing a libo installer",
43 "installdir": "LibreOffice Test",
44 "startmenu_shortcut": "program/soffice.exe",
45 "desktop_shortcut": "program/soffice.exe",
46 "addremove_icon": uninstaller_icon,
47 "major_upgrade": {
48 "AllowDowngrades": "yes",
49 "IgnoreRemoveFailure": "yes"
51 "graphics": {
52 "banner": "graphics/Banner.bmp",
53 "background": "graphics/Image_2.bmp"
55 "parts": [
57 "id": "libreoffice",
58 "title": "The LibreOffice Suite",
59 "description": "This is a test for the LibreOffice installer",
60 "absent": "disallow",
61 "staged_dir": "main"
64 "id": "libreofficefonts",
65 "title": "The LibreOffice Fonts ",
66 "description": "This is a test for the LibreOffice Fonts",
67 "absent": "allow",
68 "staged_dir": "libo-fonts"
73 lo_object = json.dumps(lo_dictionary, indent=4)
74 with open(os.path.join(creator_dir, 'lo.json'), 'w') as lo_json:
75 lo_json.write(lo_object)
77 def generate_installer():
78 os.chdir(creator_dir)
79 createmsi.run(['lo.json'])
81 if __name__ == '__main__':
82 prepare_project_dir()
83 create_creator_json()
84 generate_installer()