This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgNeels Hofmeyr has submitted this change and it was merged.
Change subject: build: conv_gen.py: ensure parent dirs of written files exist
......................................................................
build: conv_gen.py: ensure parent dirs of written files exist
Previously, this would fail when generating to $builddir if that subtree did
not exist yet in $builddir.
Change-Id: Ia4fba96dcf74a25cf3e515eb3e4f970e0c3cdd54
---
M utils/conv_gen.py
1 file changed, 9 insertions(+), 3 deletions(-)
Approvals:
Vadim Yanitskiy: Looks good to me, but someone else must approve
Neels Hofmeyr: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/utils/conv_gen.py b/utils/conv_gen.py
index 1ffeb3f..0cdba75 100644
--- a/utils/conv_gen.py
+++ b/utils/conv_gen.py
@@ -306,9 +306,15 @@
code = ConvolutionalCode(0, polys, name = name)
code.print_state_and_output(fi)
+def open_for_writing(parent_dir, base_name):
+ path = os.path.join(parent_dir, base_name)
+ if not os.path.isdir(parent_dir):
+ os.makedirs(parent_dir)
+ return open(path, 'w')
+
def generate_codes(codes, path, prefix, name):
# Open a new file for writing
- f = open(os.path.join(path, name), 'w')
+ f = open_for_writing(path, name)
f.write(mod_license + "\n")
f.write("#include <stdint.h>\n")
f.write("#include <osmocom/core/conv.h>\n\n")
@@ -335,7 +341,7 @@
def generate_vectors(codes, path, prefix, name, inc = None):
# Open a new file for writing
- f = open(os.path.join(path, name), 'w')
+ f = open_for_writing(path, name)
f.write(mod_license + "\n")
# Print includes
@@ -363,7 +369,7 @@
def generate_header(codes, path, prefix, name, description = None):
# Open a new file for writing
- f = open(os.path.join(path, name), 'w')
+ f = open_for_writing(path, name)
# Print license and includes
f.write(mod_license + "\n")
--
To view, visit https://gerrit.osmocom.org/2042
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia4fba96dcf74a25cf3e515eb3e4f970e0c3cdd54
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>