diff --git a/.gitignore b/.gitignore index 5befc03..cee299c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ output/*.html output/*.json config.js +bugdaystats.egg-info diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..f3738be --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=openstack-infra/bugdaystats.git diff --git a/bugdaystats.py b/bugdaystats.py index 9384856..19428d7 100755 --- a/bugdaystats.py +++ b/bugdaystats.py @@ -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)) diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..d49c60a --- /dev/null +++ b/setup.py @@ -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", + ], +) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..f3e0fc3 --- /dev/null +++ b/tox.ini @@ -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 .