summaryrefslogtreecommitdiff
path: root/utils/ipc/mojo/public/tools/bindings/concatenate-files.py
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-08-08 18:13:00 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-08-15 23:59:08 +0300
commit50c92cc7e2924009ecab3e4004448b01d687707c (patch)
treec22b49816a3c79dae4727780962aa0928df42b52 /utils/ipc/mojo/public/tools/bindings/concatenate-files.py
parentd3bf27180ef1d91b86b7b87a2378e559eaff5455 (diff)
meson: Move all code generation scripts to utils/codegen/
We have multiple code generation scripts in utils/, mixed with other miscellaneous utilities, as well as a larger code base based on mojom in utils/ipc/. To make code sharing easier between the generator scripts, without creating a mess in the utils/ directory, move all the code generation code to utils/codegen/. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'utils/ipc/mojo/public/tools/bindings/concatenate-files.py')
-rwxr-xr-xutils/ipc/mojo/public/tools/bindings/concatenate-files.py55
1 files changed, 0 insertions, 55 deletions
diff --git a/utils/ipc/mojo/public/tools/bindings/concatenate-files.py b/utils/ipc/mojo/public/tools/bindings/concatenate-files.py
deleted file mode 100755
index 4dd26d4a..00000000
--- a/utils/ipc/mojo/public/tools/bindings/concatenate-files.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2019 The Chromium Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# This utility concatenates several files into one. On Unix-like systems
-# it is equivalent to:
-# cat file1 file2 file3 ...files... > target
-#
-# The reason for writing a separate utility is that 'cat' is not available
-# on all supported build platforms, but Python is, and hence this provides
-# us with an easy and uniform way of doing this on all platforms.
-
-# for py2/py3 compatibility
-from __future__ import print_function
-
-import optparse
-import sys
-
-
-def Concatenate(filenames):
- """Concatenate files.
-
- Args:
- files: Array of file names.
- The last name is the target; all earlier ones are sources.
-
- Returns:
- True, if the operation was successful.
- """
- if len(filenames) < 2:
- print("An error occurred generating %s:\nNothing to do." % filenames[-1])
- return False
-
- try:
- with open(filenames[-1], "wb") as target:
- for filename in filenames[:-1]:
- with open(filename, "rb") as current:
- target.write(current.read())
- return True
- except IOError as e:
- print("An error occurred when writing %s:\n%s" % (filenames[-1], e))
- return False
-
-
-def main():
- parser = optparse.OptionParser()
- parser.set_usage("""Concatenate several files into one.
- Equivalent to: cat file1 ... > target.""")
- (_options, args) = parser.parse_args()
- sys.exit(0 if Concatenate(args) else 1)
-
-
-if __name__ == "__main__":
- main()