Update hacking, fix errors/warnings
This version of hacking doesn't understand f-strings as usable in Python 3. Update to the latest and fix current issues, which are all just formatting fixes. Change-Id: I0a7d6f93f07477b6dd29ab143130dd9064c250be
This commit is contained in:
@@ -72,7 +72,7 @@ def main():
|
|||||||
bug = launchpad.bugs[bugid]
|
bug = launchpad.bugs[bugid]
|
||||||
bug.newMessage(subject=args.subject, content=args.content)
|
bug.newMessage(subject=args.subject, content=args.content)
|
||||||
print(" done.")
|
print(" done.")
|
||||||
except lazr.restfulclient.errors.ServerError as e:
|
except lazr.restfulclient.errors.ServerError:
|
||||||
print(" TIMEOUT during save !")
|
print(" TIMEOUT during save !")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(" ERROR during save ! (%s)" % e)
|
print(" ERROR during save ! (%s)" % e)
|
||||||
|
@@ -43,7 +43,7 @@ CLOSED_SERIES = set([
|
|||||||
'newton',
|
'newton',
|
||||||
])
|
])
|
||||||
|
|
||||||
PRE_RELEASE_RE = re.compile('''
|
PRE_RELEASE_RE = re.compile(r'''
|
||||||
\.(\d+(?:[ab]|rc)+\d*)$
|
\.(\d+(?:[ab]|rc)+\d*)$
|
||||||
''', flags=re.VERBOSE | re.UNICODE)
|
''', flags=re.VERBOSE | re.UNICODE)
|
||||||
|
|
||||||
@@ -61,8 +61,8 @@ def find_modified_deliverable_files(reporoot):
|
|||||||
filenames = [
|
filenames = [
|
||||||
l.strip()
|
l.strip()
|
||||||
for l in results.splitlines()
|
for l in results.splitlines()
|
||||||
if (l.startswith('deliverables/') and
|
if (l.startswith('deliverables/')
|
||||||
not l.endswith('series_status.yaml'))
|
and not l.endswith('series_status.yaml'))
|
||||||
]
|
]
|
||||||
return filenames
|
return filenames
|
||||||
|
|
||||||
@@ -178,8 +178,8 @@ def process_release_requests(reporoot, filenames, meta_data):
|
|||||||
if not PRE_RELEASE_RE.search(r['version'])
|
if not PRE_RELEASE_RE.search(r['version'])
|
||||||
]
|
]
|
||||||
first_full_release = 'yes' if (
|
first_full_release = 'yes' if (
|
||||||
final_versions and
|
final_versions
|
||||||
this_version['version'] == final_versions[0]
|
and this_version['version'] == final_versions[0]
|
||||||
) else 'no'
|
) else 'no'
|
||||||
diff_start = this_version.get('diff-start', '-')
|
diff_start = this_version.get('diff-start', '-')
|
||||||
|
|
||||||
|
@@ -92,8 +92,8 @@ def handle_repo(path):
|
|||||||
repo.git.checkout(branch)
|
repo.git.checkout(branch)
|
||||||
repo.git.reset('--hard', 'remotes/origin/' + branch)
|
repo.git.reset('--hard', 'remotes/origin/' + branch)
|
||||||
for files in os.listdir(path):
|
for files in os.listdir(path):
|
||||||
if not ('zuul.yaml' in files or '.zuul.yaml' in files or
|
if not ('zuul.yaml' in files or '.zuul.yaml' in files
|
||||||
'zuul.d' in files or '.zuul.d' in files):
|
or 'zuul.d' in files or '.zuul.d' in files):
|
||||||
continue
|
continue
|
||||||
files = handle_branch(path)
|
files = handle_branch(path)
|
||||||
if files:
|
if files:
|
||||||
|
@@ -80,8 +80,8 @@ def main():
|
|||||||
upstream_old = p_old.get('upstream')
|
upstream_old = p_old.get('upstream')
|
||||||
else:
|
else:
|
||||||
upstream_old = ""
|
upstream_old = ""
|
||||||
if (upstream != upstream_old and
|
if (upstream != upstream_old
|
||||||
'track-upstream' in p.get('options', [])):
|
and 'track-upstream' in p.get('options', [])):
|
||||||
print("%s has changed" % name)
|
print("%s has changed" % name)
|
||||||
found_errors += check_repo(upstream)
|
found_errors += check_repo(upstream)
|
||||||
|
|
||||||
|
@@ -168,5 +168,6 @@ def main():
|
|||||||
a.connect(args.server, int(args.port), mynick)
|
a.connect(args.server, int(args.port), mynick)
|
||||||
a.start()
|
a.start()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@@ -61,8 +61,8 @@ while not done:
|
|||||||
r = requests.get(url, params=params)
|
r = requests.get(url, params=params)
|
||||||
changes = json.loads(r.text[4:])
|
changes = json.loads(r.text[4:])
|
||||||
for change in changes:
|
for change in changes:
|
||||||
if (not change.get('labels') or
|
if (not change.get('labels') or not
|
||||||
not change.get('labels').get('Verified')):
|
change.get('labels').get('Verified')):
|
||||||
continue
|
continue
|
||||||
for key, value in change['labels']['Verified'].items():
|
for key, value in change['labels']['Verified'].items():
|
||||||
if key == 'value':
|
if key == 'value':
|
||||||
|
@@ -22,7 +22,7 @@ import yaml
|
|||||||
|
|
||||||
|
|
||||||
# from :
|
# from :
|
||||||
# http://stackoverflow.com/questions/8640959/how-can-i-control-what-scalar-form-pyyaml-uses-for-my-data # flake8: noqa
|
# http://stackoverflow.com/questions/8640959/how-can-i-control-what-scalar-form-pyyaml-uses-for-my-data # noqa: E501
|
||||||
def should_use_block(value):
|
def should_use_block(value):
|
||||||
for c in u"\u000a\u000d\u001c\u001d\u001e\u0085\u2028\u2029":
|
for c in u"\u000a\u000d\u001c\u001d\u001e\u0085\u2028\u2029":
|
||||||
if c in value:
|
if c in value:
|
||||||
@@ -42,6 +42,7 @@ def my_represent_scalar(self, tag, value, style=None):
|
|||||||
self.represented_objects[self.alias_key] = node
|
self.represented_objects[self.alias_key] = node
|
||||||
return node
|
return node
|
||||||
|
|
||||||
|
|
||||||
def project_representer(dumper, data):
|
def project_representer(dumper, data):
|
||||||
return dumper.represent_mapping('tag:yaml.org,2002:map',
|
return dumper.represent_mapping('tag:yaml.org,2002:map',
|
||||||
data.items())
|
data.items())
|
||||||
@@ -150,7 +151,6 @@ def has_single_key(var):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
subprocess.run(['git', 'checkout', '--', 'zuul.d/projects.yaml'])
|
subprocess.run(['git', 'checkout', '--', 'zuul.d/projects.yaml'])
|
||||||
yaml = ruamel.yaml.YAML()
|
yaml = ruamel.yaml.YAML()
|
||||||
@@ -185,5 +185,6 @@ def main():
|
|||||||
main_out.write('\n')
|
main_out.write('\n')
|
||||||
main_out.write(line[2:])
|
main_out.write(line[2:])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@@ -71,5 +71,6 @@ def main():
|
|||||||
print("No errors found in channel setup!")
|
print("No errors found in channel setup!")
|
||||||
return errors
|
return errors
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
@@ -91,7 +91,7 @@ else:
|
|||||||
aclfd = open(aclfile)
|
aclfd = open(aclfile)
|
||||||
for line in aclfd:
|
for line in aclfd:
|
||||||
# condense whitespace to single spaces and get rid of leading/trailing
|
# condense whitespace to single spaces and get rid of leading/trailing
|
||||||
line = re.sub('\s+', ' ', line).strip()
|
line = re.sub(r'\s+', ' ', line).strip()
|
||||||
# skip empty lines
|
# skip empty lines
|
||||||
if not line:
|
if not line:
|
||||||
continue
|
continue
|
||||||
@@ -128,8 +128,8 @@ if '3' in transformations:
|
|||||||
|
|
||||||
if '4' in transformations:
|
if '4' in transformations:
|
||||||
for section in acl.keys():
|
for section in acl.keys():
|
||||||
acl[section] = [x for x in acl[section] if x !=
|
acl[section] = [x for x in acl[section]
|
||||||
'owner = group Administrators']
|
if x != 'owner = group Administrators']
|
||||||
|
|
||||||
if '5' in transformations:
|
if '5' in transformations:
|
||||||
for section in acl.keys():
|
for section in acl.keys():
|
||||||
|
@@ -30,5 +30,6 @@ def main():
|
|||||||
|
|
||||||
yaml.dump(chandata, stream=sys.stdout)
|
yaml.dump(chandata, stream=sys.stdout)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@@ -23,12 +23,13 @@ def main():
|
|||||||
data = yaml.load(open('gerrit/projects.yaml'))
|
data = yaml.load(open('gerrit/projects.yaml'))
|
||||||
|
|
||||||
for project in data:
|
for project in data:
|
||||||
if ('upstream' in project and
|
if ('upstream' in project
|
||||||
'track-upstream' not in project.get('options', [])):
|
and 'track-upstream' not in project.get('options', [])):
|
||||||
del project['upstream']
|
del project['upstream']
|
||||||
|
|
||||||
with open('gerrit/projects.yaml', 'w') as out:
|
with open('gerrit/projects.yaml', 'w') as out:
|
||||||
yaml.dump(data, stream=out)
|
yaml.dump(data, stream=out)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
2
tox.ini
2
tox.ini
@@ -34,7 +34,7 @@ deps =
|
|||||||
# zuul requirements.txt
|
# zuul requirements.txt
|
||||||
ansible>=2.7.0,<2.8
|
ansible>=2.7.0,<2.8
|
||||||
ansible-lint<4
|
ansible-lint<4
|
||||||
hacking>=1.1,<1.2
|
hacking>=2.0.0,<2.1.0
|
||||||
bashate>=0.2
|
bashate>=0.2
|
||||||
commands =
|
commands =
|
||||||
{toxinidir}/tools/run-bashate.sh
|
{toxinidir}/tools/run-bashate.sh
|
||||||
|
Reference in New Issue
Block a user