Add tox.ini, setup.py and do syntax cleanup
Add tox.ini and setup.py files. Do syntax cleanup of bugdaystats.py so checks pass now with tox.ini applied. Also update .git files. Change-Id: I7a65138bab4cb5e1194e0b35c94a847df70e3004
This commit is contained in:
parent
a878b43380
commit
f14d070ed9
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@
|
||||
output/*.html
|
||||
output/*.json
|
||||
config.js
|
||||
bugdaystats.egg-info
|
||||
|
4
.gitreview
Normal file
4
.gitreview
Normal file
@ -0,0 +1,4 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=openstack-infra/bugdaystats.git
|
@ -49,7 +49,7 @@ def update_stats(outputpath, project_name, rotation):
|
||||
counts = {}
|
||||
project = launchpad.projects[project_name]
|
||||
project_stats_filename = os.path.join(outputpath,
|
||||
"%s-bug-stats.json" % (project_name))
|
||||
"%s-bug-stats.json" % (project_name))
|
||||
|
||||
try:
|
||||
data_file = open(project_stats_filename, 'r')
|
||||
@ -75,8 +75,8 @@ def update_stats(outputpath, project_name, rotation):
|
||||
open_tasks = project.searchTasks(status=open_statuses,
|
||||
order_by='-datecreated',
|
||||
omit_duplicates=True)
|
||||
open_tasks_count = int(
|
||||
open_tasks._wadl_resource.representation['total_size'])
|
||||
open_tasks_count = int(open_tasks._wadl_resource.representation
|
||||
['total_size'])
|
||||
|
||||
counts['date'] = now
|
||||
|
||||
@ -111,7 +111,7 @@ def update_stats(outputpath, project_name, rotation):
|
||||
status='%s' % closed_status,
|
||||
omit_duplicates=True
|
||||
)._wadl_resource.representation['total_size'])
|
||||
status_key = closed_status.replace(" ","").replace("'","").lower()
|
||||
status_key = closed_status.replace(" ", "").replace("'", "").lower()
|
||||
counts[status_key] = status_count
|
||||
|
||||
for importance in importances:
|
||||
@ -124,13 +124,11 @@ def update_stats(outputpath, project_name, rotation):
|
||||
|
||||
records.append(counts)
|
||||
|
||||
report = {
|
||||
'keys': ['date', 'new', 'incomplete', 'confirmed', 'triaged',
|
||||
report = {'keys': ['date', 'new', 'incomplete', 'confirmed', 'triaged',
|
||||
'inprogress', 'fixcommitted', 'fixreleased', 'invalid',
|
||||
'wontfix', 'undecided', 'wishlist', 'low', 'medium',
|
||||
'high', 'critical'],
|
||||
'records': records
|
||||
}
|
||||
'records': records}
|
||||
|
||||
project_stats_file = open(project_stats_filename, 'w')
|
||||
project_stats_file.write(json.dumps(report, indent=4))
|
||||
|
28
setup.py
Normal file
28
setup.py
Normal file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
name="bugdaystats",
|
||||
author="Thierry Carrez",
|
||||
scripts=['bugdaystats.py'],
|
||||
install_requires=[
|
||||
"launchpadlib",
|
||||
"jinja2",
|
||||
],
|
||||
)
|
13
tox.ini
Normal file
13
tox.ini
Normal file
@ -0,0 +1,13 @@
|
||||
[tox]
|
||||
envlist = pyflakes, pep8, py27
|
||||
|
||||
[testenv]
|
||||
install_command = pip install --allow-external lazr.authentication --allow-insecure lazr.authentication -U {opts} {packages}
|
||||
|
||||
[testenv:pyflakes]
|
||||
deps = pyflakes
|
||||
commands = pyflakes bugdaystats.py
|
||||
|
||||
[testenv:pep8]
|
||||
deps = pep8==1.3.3
|
||||
commands = pep8 --ignore=E125 --repeat --show-source --exclude=.tox .
|
Loading…
Reference in New Issue
Block a user