Validate extra-atcs
Change-Id: I7c3324d73a4fc18329270f845aba6904d3f9a539
This commit is contained in:
parent
912a9424eb
commit
cdbc906dc9
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@ -0,0 +1,2 @@
|
||||
pytz
|
||||
PyYAML>=3.1.0,<=3.10
|
@ -4,4 +4,3 @@
|
||||
# needed for doc build
|
||||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
|
||||
oslosphinx>=2.5.0 # Apache-2.0
|
||||
PyYAML>=3.1.0,<=3.10
|
||||
|
@ -6,6 +6,7 @@ import sys
|
||||
import urllib
|
||||
import re
|
||||
import datetime
|
||||
import pytz
|
||||
|
||||
DATE_MIN = '2015-03-04'
|
||||
DATE_MAX = '2016-01-03'
|
||||
@ -17,6 +18,18 @@ PROJECTS_URL = ('%s/openstack/governance/plain/reference/projects.yaml?%s' %
|
||||
|
||||
date_min = datetime.datetime.strptime(DATE_MIN, '%Y-%m-%d').strftime('%s')
|
||||
date_max = datetime.datetime.strptime(DATE_MAX, '%Y-%m-%d').strftime('%s')
|
||||
now = datetime.datetime.utcnow().replace(tzinfo=pytz.utc,
|
||||
hour=0,
|
||||
minute=0,
|
||||
second=0,
|
||||
microsecond=0)
|
||||
|
||||
|
||||
def check_atc_date(atc):
|
||||
if 'expires-in' not in atc:
|
||||
return False
|
||||
expires_in = datetime.datetime.strptime(atc['expires-in'], '%B %Y').replace(tzinfo=pytz.utc)
|
||||
return now < expires_in
|
||||
|
||||
|
||||
def check_date(date):
|
||||
@ -40,7 +53,7 @@ except:
|
||||
exit(1)
|
||||
|
||||
project_name = project_name.replace('_', ' ')
|
||||
author = escape_author(author)
|
||||
author = author.replace('_', ' ')
|
||||
|
||||
if not os.path.isfile('.projects.yaml'):
|
||||
open('.projects.yaml', 'w').write(
|
||||
@ -58,9 +71,14 @@ else:
|
||||
exit(1)
|
||||
|
||||
for project in project_list:
|
||||
for atc in project['extra-atcs']:
|
||||
if atc['name'] == author and check_atc_date(atc):
|
||||
print "Valid extra ATC record", atc
|
||||
exit(0)
|
||||
for deliverable in project['deliverables'].values():
|
||||
for repo_name in deliverable["repos"]:
|
||||
url = '%s/%s/log/?qt=author&q=%s' % (BASE_URL, repo_name, author)
|
||||
url = '%s/%s/log/?qt=author&q=%s' % (BASE_URL, repo_name,
|
||||
escape_author(author))
|
||||
print "Querying: %s" % url
|
||||
found = False
|
||||
for l in urllib.urlopen(url).read().split('\n'):
|
||||
|
3
tox.ini
3
tox.ini
@ -7,7 +7,8 @@ skipsdist = True
|
||||
usedevelop = True
|
||||
install_command = pip install -U {opts} {packages}
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
Loading…
Reference in New Issue
Block a user