
In order to run PEP8-compliance tests using PBR, the setup.py, setup.cfg, requirements.txt, and tox.ini files must exist in the base directory of this project. These files have been created and specified accordingly. The specific environments to be tested using tox are specified in requirements.txt and include the py33 and pep8 environments. Package requirements are specified in requirements.txt and include pyyaml and icalendar. Additional package requirements for testing are specified in test-requirements.txt and include pbr and hacking. Existing Python source code has been modified to pass PEP8-compliance checks. This included adding docstrings and limiting line length. Lastly, the README file has been renamed and files have been added for the project license and manifest. Change-Id: I51a50d64c579212c5c7fa756bb1d34e774666be9
74 lines
2.1 KiB
Python
74 lines
2.1 KiB
Python
#! /usr/bin/env python
|
|
#
|
|
# Copyright 2014 North Dakota State University
|
|
#
|
|
# 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 logging
|
|
import os
|
|
import yaml
|
|
|
|
import const
|
|
from meeting import Meeting
|
|
|
|
# logging settings
|
|
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(message)s',
|
|
level=logging.DEBUG)
|
|
|
|
yaml_dir = '../meetings'
|
|
ical_dir = '../icals'
|
|
# NOTE(jotan): publish_url should be changed to the wiki URL eventually
|
|
publish_url = '127.0.0.1'
|
|
|
|
|
|
class MeetingJobs:
|
|
"""Executes post, gate, and check jobs."""
|
|
|
|
def execute_check(self):
|
|
"""Execute check job."""
|
|
|
|
logging.info('Check job initiated.')
|
|
meetings = self.retrieve_meetings(yaml_dir)
|
|
|
|
# convert meetings to a list of ical
|
|
for m in meetings:
|
|
m.write_ical()
|
|
logging.info('Wrote %d meetings to iCal' % (len(meetings)))
|
|
logging.info('Check job finished.')
|
|
|
|
def execute_gate(self):
|
|
"""Execute gate job."""
|
|
|
|
pass
|
|
|
|
def execute_post(self):
|
|
"""Execute post job."""
|
|
|
|
pass
|
|
|
|
def retrieve_meetings(self, yaml_dir):
|
|
"""Return a list of Meetings initialized from files in yaml_dir."""
|
|
|
|
os.chdir(yaml_dir)
|
|
meetings_yaml = [f for f in os.listdir()
|
|
if os.path.isfile(f) and
|
|
f.endswith(const.YAML_FILE_EXT)]
|
|
meetings = [Meeting(yaml.load(open(f, 'r')), f)
|
|
for f in meetings_yaml]
|
|
logging.info('Loaded %d meetings from YAML' % (len(meetings)))
|
|
return meetings
|
|
|
|
# entry point
|
|
jobs = MeetingJobs()
|
|
jobs.execute_check()
|