Merge "Allow importing the owner script."
This commit is contained in:
commit
da124b0f58
@ -94,12 +94,16 @@ import csv
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import string
|
||||
import sys
|
||||
|
||||
import requests
|
||||
import yaml
|
||||
|
||||
try:
|
||||
from string import maketrans
|
||||
except ImportError: # Python3
|
||||
maketrans = bytes.maketrans
|
||||
|
||||
|
||||
def dumper(data, stream):
|
||||
"""Convenience wrapper to consistently set YAML formatting"""
|
||||
@ -119,7 +123,7 @@ def normalize_email(email):
|
||||
def normalize_project(project):
|
||||
"""Replace spaces and hyphens with underscores in project teams
|
||||
and then lower-case them, for more convenient filenames"""
|
||||
return project.translate(string.maketrans(' -', '__')).lower()
|
||||
return project.translate(maketrans(' -', '__')).lower()
|
||||
|
||||
|
||||
def date_merged(change, after=None, before=None):
|
||||
@ -178,14 +182,8 @@ def query_gerrit(query):
|
||||
return decoded
|
||||
|
||||
|
||||
def main():
|
||||
"""The giant pile of spaghetti which does everything else"""
|
||||
|
||||
# Record the start time for use later
|
||||
start = datetime.datetime.utcnow()
|
||||
|
||||
# TODO(fungi): this could be trivially extracted to a separate
|
||||
# function
|
||||
def usage(argv):
|
||||
"""Parse command line argument"""
|
||||
parser = argparse.ArgumentParser(
|
||||
description="When run using OpenStack's Gerrit server, this builds "
|
||||
"YAML representations of aggregate change owner details and change "
|
||||
@ -203,7 +201,16 @@ def main():
|
||||
parser.add_argument("-o", "--outdir", help="Create an output directory")
|
||||
parser.add_argument("-r", "--ref", help="Specify a Governance refname")
|
||||
parser.add_argument("-s", "--sieve", help="Add Gerrit query parameters")
|
||||
options = parser.parse_args()
|
||||
return parser.parse_args(argv[1:])
|
||||
|
||||
|
||||
def main(argv=sys.argv):
|
||||
"""The giant pile of spaghetti which does everything else"""
|
||||
|
||||
# Record the start time for use later
|
||||
start = datetime.datetime.utcnow()
|
||||
|
||||
options = usage(argv)
|
||||
|
||||
# If we're supplied a configuration file, use it
|
||||
if options.config:
|
||||
@ -638,4 +645,5 @@ def main():
|
||||
fd.writelines(electorate)
|
||||
fd.close()
|
||||
|
||||
main()
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user