diff options
author | Vincent Ambo <mail@tazj.in> | 2022-02-07T23·05+0300 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-02-07T23·09+0000 |
commit | 5aa5d282eac56a21e74611c1cdbaa97bb5db2dca (patch) | |
tree | 8cc5dce8157a1470ff76719dd15d65f648a05522 /third_party/abseil_cpp/absl/copts/generate_copts.py | |
parent | a25675804c4f429fab5ee5201fe25e89865dfd13 (diff) |
chore(3p/abseil_cpp): unvendor abseil_cpp r/3786
we weren't actually using these sources anymore, okay? Change-Id: If701571d9716de308d3512e1eb22c35db0877a66 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5248 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi> Autosubmit: tazjin <tazjin@tvl.su>
Diffstat (limited to 'third_party/abseil_cpp/absl/copts/generate_copts.py')
-rwxr-xr-x | third_party/abseil_cpp/absl/copts/generate_copts.py | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/third_party/abseil_cpp/absl/copts/generate_copts.py b/third_party/abseil_cpp/absl/copts/generate_copts.py deleted file mode 100755 index 0e5dc9fad295..000000000000 --- a/third_party/abseil_cpp/absl/copts/generate_copts.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/python -"""Generate Abseil compile compile option configs. - -Usage: <path_to_absl>/copts/generate_copts.py - -The configs are generated from copts.py. -""" - -from os import path -import sys -from copts import COPT_VARS - - -# Helper functions -def file_header_lines(): - return [ - "GENERATED! DO NOT MANUALLY EDIT THIS FILE.", "", - "(1) Edit absl/copts/copts.py.", - "(2) Run `python <path_to_absl>/copts/generate_copts.py`." - ] - - -def flatten(*lists): - return [item for sublist in lists for item in sublist] - - -def relative_filename(filename): - return path.join(path.dirname(__file__), filename) - - -# Style classes. These contain all the syntactic styling needed to generate a -# copt file for different build tools. -class CMakeStyle(object): - """Style object for CMake copts file.""" - - def separator(self): - return "" - - def list_introducer(self, name): - return "list(APPEND " + name - - def list_closer(self): - return ")\n" - - def docstring(self): - return "\n".join((("# " + line).strip() for line in file_header_lines())) - - def filename(self): - return "GENERATED_AbseilCopts.cmake" - - -class StarlarkStyle(object): - """Style object for Starlark copts file.""" - - def separator(self): - return "," - - def list_introducer(self, name): - return name + " = [" - - def list_closer(self): - return "]\n" - - def docstring(self): - docstring_quotes = "\"\"\"" - return docstring_quotes + "\n".join( - flatten(file_header_lines(), [docstring_quotes])) - - def filename(self): - return "GENERATED_copts.bzl" - - -def copt_list(name, arg_list, style): - """Copt file generation.""" - - make_line = lambda s: " \"" + s + "\"" + style.separator() - external_str_list = [make_line(s) for s in arg_list] - - return "\n".join( - flatten( - [style.list_introducer(name)], - external_str_list, - [style.list_closer()])) - - -def generate_copt_file(style): - """Creates a generated copt file using the given style object. - - Args: - style: either StarlarkStyle() or CMakeStyle() - """ - with open(relative_filename(style.filename()), "w") as f: - f.write(style.docstring()) - f.write("\n") - for var_name, arg_list in sorted(COPT_VARS.items()): - f.write("\n") - f.write(copt_list(var_name, arg_list, style)) - - -def main(argv): - if len(argv) > 1: - raise RuntimeError("generate_copts needs no command line args") - - generate_copt_file(StarlarkStyle()) - generate_copt_file(CMakeStyle()) - - -if __name__ == "__main__": - main(sys.argv) |