8 from tools
import uncompress_file_to_dir
, get_file_info
10 from config
import parse_config
11 from path
import UpdaterPath
12 from signing
import sign_mar_file
14 current_dir_path
= os
.path
.dirname(os
.path
.realpath(__file__
))
16 def make_complete_mar_name(target_dir
, filename_prefix
, language
):
17 filename
= filename_prefix
+ "_" + language
+ "_complete_langpack.mar"
18 return os
.path
.join(target_dir
, filename
)
20 def create_lang_infos(mar_file_name
, language
, url
):
21 data
= {'lang' : language
,
22 'complete' : get_file_info(mar_file_name
, url
)
28 print("Usage: create_full_mar_for_languages.py $PRODUCTNAME $WORKDIR $TARGETDIR $TEMPDIR $FILENAMEPREFIX $UPDATE_CONFIG")
31 update_config
= sys
.argv
[4]
32 filename_prefix
= sys
.argv
[3]
34 product_name
= sys
.argv
[1]
36 updater_path
= UpdaterPath(workdir
)
37 target_dir
= updater_path
.get_update_dir()
38 temp_dir
= updater_path
.get_language_dir()
40 config
= parse_config(update_config
)
42 language_pack_dir
= os
.path
.join(workdir
, "installation", product_name
+ "_languagepack", "archive", "install")
43 language_packs
= os
.listdir(language_pack_dir
)
45 for language
in language_packs
:
49 language_dir
= os
.path
.join(language_pack_dir
, language
)
50 language_file
= os
.path
.join(language_dir
, os
.listdir(language_dir
)[0])
52 directory
= uncompress_file_to_dir(language_file
, os
.path
.join(temp_dir
, language
))
54 mar_file_name
= make_complete_mar_name(target_dir
, filename_prefix
, language
)
56 subprocess
.call([os
.path
.join(current_dir_path
, 'make_full_update.sh'), mar_file_name
, directory
])
58 sign_mar_file(target_dir
, config
, mar_file_name
, filename_prefix
)
60 lang_infos
.append(create_lang_infos(mar_file_name
, language
, config
.base_url
))
62 with
open(os
.path
.join(target_dir
, "complete_lang_info.json"), "w") as language_info_file
:
63 json
.dump({'languages' : lang_infos
}, language_info_file
, indent
=4)
65 if __name__
== '__main__':