]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/buckifier/targets_builder.py
1 from __future__
import absolute_import
2 from __future__
import division
3 from __future__
import print_function
4 from __future__
import unicode_literals
8 # TODO(tec): replace this with PrettyPrinter
9 def pretty_list(lst
, indent
=6):
10 if lst
is None or len(lst
) == 0:
14 return "\"%s\"" % lst
[0]
16 separator
= "\",\n%s\"" % (" " * indent
)
17 res
= separator
.join(lst
)
18 res
= "\n" + (" " * indent
) + "\"" + res
+ "\",\n" + (" " * (indent
- 2))
23 def __init__(self
, path
):
25 self
.targets_file
= open(path
, 'w')
26 self
.targets_file
.write(targets_cfg
.rocksdb_target_header
)
33 self
.targets_file
.close()
35 def add_library(self
, name
, srcs
, deps
=None, headers
=None):
37 headers
= "AutoHeaders.RECURSIVE_GLOB"
38 self
.targets_file
.write(targets_cfg
.library_template
% (
43 self
.total_lib
= self
.total_lib
+ 1
45 def add_binary(self
, name
, srcs
, deps
=None):
46 self
.targets_file
.write(targets_cfg
.binary_template
% (
50 self
.total_bin
= self
.total_bin
+ 1
52 def register_test(self
, test_name
, src
, is_parallel
):
55 exec_mode
= "parallel"
56 self
.tests_cfg
.append([test_name
, str(src
), str(exec_mode
)])
58 self
.total_test
= self
.total_test
+ 1
60 def flush_tests(self
):
61 self
.targets_file
.write(targets_cfg
.unittests_template
% (
62 pprint
.PrettyPrinter().pformat(self
.tests_cfg
)