mirror of
https://github.com/lubuntu-team/lugito.git
synced 2025-06-30 17:41:34 +00:00
* Significant refactoring: lugito wrapped into a class with common methods, IRC and Launchpad communications separated as connectors with a separate webhook module. * Some unit-tests added * Added functionality for ircbot to respond to diff links and info as well as extracting anchor links from tasks / diffs e.g. D15#167 * Built into a python package structure Still Requires: * Improved test coverage * Package documentation * Additional functionality for other phabricator apps
67 lines
1.5 KiB
Python
67 lines
1.5 KiB
Python
#! /usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
# S.D.G
|
|
"""
|
|
:mod:`lugito.connectors.launchpad`
|
|
======================================
|
|
|
|
Define a launchpad connector class
|
|
|
|
.. currentmodule:: lugito.connectors.launchpad
|
|
"""
|
|
|
|
# Imports
|
|
import logging
|
|
import phabricator
|
|
from launchpadlib.launchpad import Launchpad
|
|
|
|
|
|
class LPConnector(object):
|
|
|
|
def __init__(self, log_level=logging.DEBUG):
|
|
|
|
# Launchpad info
|
|
# Read the configuration out of the .arcconfig file
|
|
self.application = phabricator.ARCRC['launchpad']['application']
|
|
self.staging = phabricator.ARCRC['launchpad']['staging']
|
|
self.version = phabricator.ARCRC['launchpad']['version']
|
|
self.supported_vers =\
|
|
phabricator.ARCRC['launchpad']['supported_versions']
|
|
|
|
# Phabricator info
|
|
self.phab = phabricator.Phabricator()
|
|
self.phab_host = phabricator.ARCRC['config']['default'].replace(
|
|
'api/', '')
|
|
|
|
self.logger = logging.getLogger('lugito.connector.LPConnector')
|
|
|
|
# Add log level
|
|
ch = logging.StreamHandler()
|
|
|
|
formatter = logging.Formatter(
|
|
'%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
ch.setFormatter(formatter)
|
|
|
|
self.logger.addHandler(ch)
|
|
self.logger.setLevel(log_level)
|
|
|
|
|
|
def connect(self):
|
|
"""Connect"""
|
|
|
|
self.logger.info("Connecting to Launchpad")
|
|
|
|
|
|
def send(self, objectstr, who, body, link):
|
|
pass
|
|
|
|
|
|
def listen(self):
|
|
pass
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
obj = LPConnector()
|
|
|