Files
create/src/Tools/catfiles.py
ᴩʜᴏɴᴇᴅʀᴏɪᴅ 489e429b5c SPDX [ 29 ][ Src / Tools ] (#24999)
* [ Tools ]: Update SPDX License Identifiers

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-11-02 16:21:34 -06:00

45 lines
1.0 KiB
Python

#! python
# SPDX-License-Identifier: LGPL-2.1-or-later
# (c) 2018 Werner Mayer LGPL
#
import sys, getopt
# import os # The code that needs this is commented out
import shutil
def main():
outputfile = ""
try:
opts, args = getopt.getopt(sys.argv[1:], "o:", ["outputfile="])
except getopt.GetoptError:
pass
for o, a in opts:
if o in ("-o", "--outputfile"):
outputfile = a
# if os.path.exists(outputfile):
# do_not_create = True
# ts = os.path.getmtime(outputfile)
# for f in args:
# if os.path.getmtime(f) > ts:
# do_not_create = False
# break
#
# if do_not_create:
# print ("Up-to-date file {0}".format(outputfile))
# return
with open(outputfile, "wb") as wfd:
for f in args:
with open(f, "rb") as fd:
shutil.copyfileobj(fd, wfd, 1024 * 1024 * 10)
print("Created file {0}".format(outputfile))
if __name__ == "__main__":
main()