1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # generate AutoInstall files from gbuild data for further scp2 processing
12 from __future__
import print_function
17 scp2componentcondition
= sys
.argv
[2]
18 scp2libtemplate
= sys
.argv
[3]
19 scp2exetemplate
= sys
.argv
[4]
20 scp2jartemplate
= sys
.argv
[5]
21 scp2pkgtemplate
= sys
.argv
[6]
22 # use 'with open(file) as f:' to avoid 'ResourceWarning: unclosed file'
23 with
open(sys
.argv
[7]) as f
:
24 sdklibs
= f
.readline().split()
25 with
open(sys
.argv
[8]) as f
:
26 libs
= f
.readline().split()
27 with
open(sys
.argv
[9]) as f
:
28 exes
= f
.readline().split()
29 with
open(sys
.argv
[10]) as f
:
30 jars
= f
.readline().split()
31 with
open(sys
.argv
[11]) as f
:
32 pkgs
= f
.readline().split()
34 if len(scp2componentcondition
) > 0:
35 scp2componentcondition
= "," + scp2componentcondition
38 return string
.replace(".", "_").replace("-", "_").replace("/", "_")
44 ret
.append((l
[i
], l
[i
+1]))
52 ret
.append((l
[i
], l
[i
+1], l
[i
+2]))
56 print("/* autogenerated installs for group " + module
+ " */")
57 print("#define auto_" + module
+ "_ALL \\")
59 autosdklibs
= [("auto_" + module
+ "_link_" + escape(lib
),link
,target
) for (lib
,link
,target
) in to_triple(sdklibs
)]
60 autolibs
= [("auto_" + module
+ "_lib_" + escape(lib
),libfile
) for (lib
,libfile
) in to_tuple(libs
)]
61 autoexes
= [("auto_" + module
+ "_exe_" + escape(exe
),exefile
) for (exe
,exefile
) in to_tuple(exes
)]
62 autojars
= [("auto_" + module
+ "_jar_" + escape(jar
),jar
+ ".jar") for jar
in jars
]
63 autopkgs
= [("auto_" + module
+ "_pkg_" + escape(pkg
),pkg
+ ".filelist") for pkg
in pkgs
]
65 allgids
= [gid
for (gid
,_
,_
) in autosdklibs
] + \
66 [gid
for (gid
,_
) in autolibs
] + \
67 [gid
for (gid
,_
) in autoexes
] + \
68 [gid
for (gid
,_
) in autojars
] + \
69 [gid
for (gid
,_
) in autopkgs
]
71 print(", \\\n".join([" " + gid
for gid
in allgids
]))
73 for (gid
, link
, target
) in autosdklibs
:
74 print("SDK_LIBRARY_LINK(" + gid
+ "," + link
+ "," + target
+ ")")
76 scp2libtemplates
= set([ "URE_PRIVATE_LIB", "LIBO_LIB_FILE", "LIBO_LIB_FILE_BINARYTABLE", "LIBO_LIB_FILE_COMPONENTCONDITION", "SHLXTHDL_LIB_FILE", "SHLXTHDL_LIB_FILE_COMPONENTCONDITION" ])
77 for (gid
, libfile
) in autolibs
:
78 if not(scp2libtemplate
in scp2libtemplates
):
79 raise Exception("invalid scp2libtemplate \"" + scp2libtemplate
+ "\"")
80 print(scp2libtemplate
+ "(" + gid
+ "," + libfile
+ scp2componentcondition
+ ")")
82 scp2exetemplates
= set([ "URE_EXECUTABLE", "LIBO_EXECUTABLE", "LIBO_EXECUTABLE_COMPONENTCONDITION", "SDK_EXECUTABLE" ])
83 for (gid
, exefile
) in autoexes
:
84 if not(scp2exetemplate
in scp2exetemplates
):
85 raise Exception("invalid scp2exetemplate \"" + scp2exetemplate
+ "\"")
86 print(scp2exetemplate
+ "(" + gid
+ "," + exefile
+ scp2componentcondition
+ ")")
88 scp2jartemplates
= set([ "URE_JAR_FILE", "LIBO_JAR_FILE" ])
89 for (gid
, jarfile
) in autojars
:
90 if not(scp2jartemplate
in scp2jartemplates
):
91 raise Exception("invalid scp2jartemplate \"" + scp2jartemplate
+ "\"")
92 print(scp2jartemplate
+ "(" + gid
+ "," + jarfile
+ scp2componentcondition
+ ")")
94 scp2pkgtemplates
= set([ "PACKAGE_FILELIST", "PACKAGE_FILELIST_COMPONENTCONDITION","PACKAGE_FILELIST_FONT", "SDK_PACKAGE_FILELIST" ])
95 for (gid
, pkgfilelist
) in autopkgs
:
96 if not(scp2pkgtemplate
in scp2pkgtemplates
):
97 raise Exception("invalid scp2pkgtemplate \"" + scp2pkgtemplate
+ "\"")
98 print(scp2pkgtemplate
+ "(" + gid
+ "," + pkgfilelist
+ scp2componentcondition
+ ")")
100 # vim:set shiftwidth=4 softtabstop=4 expandtab: