Codebase list mozc / 81edac6
Update from the upstream. (BUILD=4200) * Updated the version from 2.25 to 2.26. * Refined build rules for macOS. * Code refactoring. There are no feature changes between 2.25 and 2.26. The diffrences are only build system updates (i.e. supports of Python3, Bazel, etc.) and code refactoring. Hiroyuki Komatsu 3 years ago
21 changed file(s) with 40 addition(s) and 30 deletion(s). Raw diff Collapse all Expand all
134134 parser.add_option("--verify", dest="verify", action="store_true",
135135 default=False)
136136 parser.add_option("--notarization_id", dest="notarization_id")
137 parser.add_option("--output", dest="output")
137138 (options, unused_args) = parser.parse_args()
138139
139140 if not options.target:
175176 if opts.notarization_id:
176177 Notarize(opts.target, opts.notarization_id)
177178
179 # Output something to make the processes trackable.
180 if opts.output:
181 with open(opts.output, "w") as output:
182 output.write("Done")
178183
179184 if __name__ == "__main__":
180185 main()
2727 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2828 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929
30 """Creates versioned files and information files of the files.
30 r"""Creates versioned files and information files of the files.
3131
3232 When the version is "1.2.3.4", the following command creates these four files.
3333 /PATH/TO/file1-1.2.3.4.ext : Copied from /PATH/TO/file1.ext
5353 import optparse
5454 import os
5555 import shutil
56 import six
5657
5758 from build_tools import mozc_version
5859
8889 package = os.path.basename(new_file_path)
8990 file_size = os.path.getsize(new_file_path)
9091 sha1_digest = _GetSha1Digest(new_file_path)
91 sha1_hash = base64.b64encode(sha1_digest)
92 sha1_hash_hex = sha1_digest.encode('hex')
92 if six.PY3:
93 sha1_hash = base64.b64encode(sha1_digest).decode('latin1')
94 sha1_hash_hex = sha1_digest.hex()
95 else:
96 sha1_hash = base64.b64encode(sha1_digest)
97 sha1_hash_hex = sha1_digest.encode('hex')
9398 with open('%s.info' % new_file_path, 'w') as output:
9499 output.write('package\t%s\n' % package)
95100 output.write('build_id\t%s\n' % build_id)
4949 std::string result;
5050 size_t pos = 0;
5151
52 while (getline(std::cin, command)) {
52 while (std::getline(std::cin, command)) {
5353 char initial = command[0];
5454 if (initial == '-' || (initial >= '0' && initial <= '9')) {
5555 std::stringstream ss;
4747
4848 std::string command;
4949 std::string result;
50 while (getline(std::cin, command)) {
50 while (std::getline(std::cin, command)) {
5151 converter.Convert(command, &result);
5252 std::cout << result << std::endl;
5353 }
444444 std::string line;
445445 const std::string empty_pending("");
446446 while (!is->eof()) {
447 getline(*is, line);
447 std::getline(*is, line);
448448 Util::ChopReturns(&line);
449449 if (line.empty()) {
450450 continue;
2929
3030 MAJOR = 2
3131
32 MINOR = 25
32 MINOR = 26
3333
3434 # Number to be increased. This value may be replaced by other tools.
3535 BUILD = 4190
3939 : stream_(filename.c_str()), done_(false), array_index_(-1), cost_(0) {
4040 LOG(INFO) << "Loading " << filename;
4141 std::string header;
42 CHECK(!getline(stream_, header).fail()) << filename << " is empty.";
42 CHECK(!std::getline(stream_, header).fail()) << filename << " is empty.";
4343 pos_size_ = NumberUtil::SimpleAtoi(header);
4444 Next();
4545 }
5454 return;
5555 }
5656 std::string line;
57 done_ = getline(stream_, line).fail();
57 done_ = std::getline(stream_, line).fail();
5858 if (done_) {
5959 return;
6060 }
208208 InputFileStream input(suggestion_filter_files_[i].c_str());
209209 CHECK(input) << "cannot open: " << suggestion_filter_files_[i];
210210 std::string line;
211 while (getline(input, line)) {
211 while (std::getline(input, line)) {
212212 if (line.empty() || line[0] == '#') {
213213 continue;
214214 }
226226 CHECK(input) << "cannot open: " << dictionary_files_[i];
227227 std::vector<std::string> fields;
228228 std::string line;
229 while (getline(input, line)) {
229 while (std::getline(input, line)) {
230230 fields.clear();
231231 Util::SplitStringUsing(line, "\t", &fields);
232232 CHECK_GE(fields.size(), 5);
6161 dic->clear();
6262 std::string line;
6363 std::vector<std::string> fields;
64 while (!getline(*ifs, line).fail()) {
64 while (!std::getline(*ifs, line).fail()) {
6565 fields.clear();
6666 Util::SplitStringUsing(line, "\t", &fields);
6767 CHECK_GE(fields.size(), 4);
325325 CHECK(dic);
326326
327327 std::string line;
328 while (!getline(is, line).fail()) {
328 while (!std::getline(is, line).fail()) {
329329 if (line.empty() || line[0] == '#') {
330330 continue;
331331 }
4949 void ReadWords(const std::string &name, std::vector<uint64> *words) {
5050 std::string line;
5151 mozc::InputFileStream input(name.c_str());
52 while (getline(input, line)) {
52 while (std::getline(input, line)) {
5353 if (line.empty() || line[0] == '#') {
5454 continue;
5555 }
5757 InputFileStream ifs(FLAGS_collocation_data.c_str());
5858 std::string line;
5959 std::vector<std::string> entries;
60 while (!getline(ifs, line).fail()) {
60 while (!std::getline(ifs, line).fail()) {
6161 if (line.empty()) {
6262 continue;
6363 }
6868 InputFileStream ifs(FLAGS_suppression_data.c_str());
6969 std::string line;
7070
71 while (!getline(ifs, line).fail()) {
71 while (!std::getline(ifs, line).fail()) {
7272 if (line.empty()) {
7373 continue;
7474 }
8080 InputFileStream ifs(path.c_str());
8181
8282 std::string line;
83 getline(ifs, line); // Skip header
83 std::getline(ifs, line); // Skip header
8484
8585 std::vector<std::pair<std::string, KeyList>> data;
8686 mozc_hash_map<std::string, int> key_count;
87 while (getline(ifs, line)) {
87 while (std::getline(ifs, line)) {
8888 std::vector<absl::string_view> field_list;
8989 Util::SplitStringUsing(line, "\t", &field_list);
9090 CHECK_GE(field_list.size(), 2) << "Format error: " << line;
7070 int sorting_key = 0;
7171 InputFileStream rule_ifs(rule_file.c_str());
7272 CHECK(rule_ifs.good());
73 while (!getline(rule_ifs, line).fail()) {
73 while (!std::getline(rule_ifs, line).fail()) {
7474 if (line.empty() || line[0] == '#') {
7575 continue;
7676 }
8181 InputFileStream auto_ifs(auto_file.c_str());
8282 CHECK(auto_ifs.good());
8383
84 while (!getline(auto_ifs, line).fail()) {
84 while (!std::getline(auto_ifs, line).fail()) {
8585 if (line.empty() || line[0] == '#') {
8686 continue;
8787 }
156156 CHECK(ifs.good());
157157
158158 std::string line;
159 CHECK(!getline(ifs, line).fail()); // get first line
159 CHECK(!std::getline(ifs, line).fail()); // get first line
160160
161161 std::vector<std::string> fields;
162 while (!getline(ifs, line).fail()) {
162 while (!std::getline(ifs, line).fail()) {
163163 fields.clear();
164164 // Format:
165165 // POS <tab> value <tab> readings(space delimitered) <tab>
145145
146146 std::string line;
147147 std::vector<std::string> fields;
148 while (!getline(ifs, line).fail()) {
148 while (!std::getline(ifs, line).fail()) {
149149 if (line.empty() || line[0] == '#') {
150150 continue;
151151 }
181181 std::map<std::string, int> conjugation_id_map;
182182
183183 int conjugation_id = 0;
184 while (!getline(ifs, line).fail()) {
184 while (!std::getline(ifs, line).fail()) {
185185 if (line.empty() || line[0] == '#') {
186186 // starting with '#' is a comment line.
187187 continue;
5959 std::vector<KeyInformation> result;
6060
6161 std::string line;
62 getline(*ifs, line); // Skip the first line.
62 std::getline(*ifs, line); // Skip the first line.
6363 while (!ifs->eof()) {
64 getline(*ifs, line);
64 std::getline(*ifs, line);
6565 Util::ChopReturns(&line);
6666 if (line.empty() || line[0] == '#') {
6767 // empty or comment
5656
5757 commands::Command command;
5858 std::string line;
59 while (getline(*input, line)) {
59 while (std::getline(*input, line)) {
6060 Util::ChopReturns(&line);
6161 if (line.size() > 1 && line[0] == '#' && line[1] == '#') {
6262 continue;
348348 std::string line_text;
349349 int line_number = 0;
350350 std::vector<std::string> columns;
351 while (getline(input_stream, line_text)) {
351 while (std::getline(input_stream, line_text)) {
352352 ++line_number;
353353 SCOPED_TRACE(Util::StringPrintf("Scenario: %s [%s:%d]", line_text.c_str(),
354354 scenario_path.c_str(), line_number));
225225 return -1;
226226 }
227227
228 return id_list_[distance(word_list_.begin(), iter)];
228 return id_list_[std::distance(word_list_.begin(), iter)];
229229 }
230230
231231 } // namespace louds
7676 mozc::commands::Command command;
7777 std::string line;
7878
79 while (getline(std::cin, line)) {
79 while (std::getline(std::cin, line)) {
8080 command.clear_input();
8181 command.clear_output();
8282 uint32 event_id = 0;