osquery-1/tools/codegen/genwebsitemetadata.py
Jesse Kornblum c7355b19aa Update osquery licensing wording (#5452)
Summary:
Pull Request resolved: https://github.com/facebook/osquery/pull/5452

As suggested in another diff, this diff updates the language we use to describe the osquery licensing terms. We are changing all instances of

//This source code is licensed as defined on the LICENSE file found in the root directory of this source tree.//

to

//This source code is licensed in accordance with the terms specified in the LICENSE file found in the root directory of this source tree.//

We accomplish this with a codemod:

  $ codemod -md xplat/osquery/oss --extensions cpp,h,in,py,sh,mm,ps1 "(.\s+)This source code is licensed as defined on the LICENSE file found in the(.*)root directory of this source tree\." "\1This source code is licensed in accordance with the terms specified in\2the LICENSE file found in the root directory of this source tree."

Reviewed By: fmanco

Differential Revision: D14131290

fbshipit-source-id: 52c90da342263e2a80f5a678ecd760c19cf7513e
2019-02-19 10:59:48 -08:00

42 lines
1.3 KiB
Python
Executable File

#!/usr/bin/env python
"""
Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
Generate a new website version metadata file based on a new release version
Usage:
python tools/codegen/genwebsitemetadata.py --file=~/osquery-site/src/data/osquery_metadata.json
"""
# Copyright (c) 2014-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed in accordance with the terms specified in
# the LICENSE file found in the root directory of this source tree.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import io
import json
import sys
def main(argc, argv):
parser = argparse.ArgumentParser(
"Generate a new website version metadata file based on a new release")
parser.add_argument("--file", help="Path to metadata file", required=True)
parser.add_argument("--version", help="Version identifier", required=True)
args = parser.parse_args()
metadata = json.load(open(args.file))
metadata["current_version"] = args.version
metadata["all_versions"].append(args.version)
with io.open(args.file, 'w', encoding='utf-8') as f:
f.write(json.dumps(metadata, indent=2, separators=(',', ':')))
if __name__ == "__main__":
main(len(sys.argv), sys.argv)