summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-01-09 16:52:07 -0800
committerDan Albert <danalbert@google.com>2015-01-09 16:53:09 -0800
commit8a15a4e5c4ab39aa67c8a0d8a6b7961c20b83373 (patch)
tree9f0752685fbc0b0827fdcc2ce74071073364eab1 /tools
parent2f8f6db5e4730a9f52be7415236f5ea55623d789 (diff)
downloadbionic-8a15a4e5c4ab39aa67c8a0d8a6b7961c20b83373.zip
bionic-8a15a4e5c4ab39aa67c8a0d8a6b7961c20b83373.tar.gz
bionic-8a15a4e5c4ab39aa67c8a0d8a6b7961c20b83373.tar.bz2
Use relative imports.
Making `bionicbb` its own package required `PYTHONPATH=..`, which we don't want. Just use a relative import instead. Change-Id: I59b9852522118ece89829288a4921902e756e4aa
Diffstat (limited to 'tools')
-rw-r--r--tools/bionicbb/__init__.py0
-rw-r--r--tools/bionicbb/build_listener.py4
-rw-r--r--tools/bionicbb/gmail_listener.py25
3 files changed, 14 insertions, 15 deletions
diff --git a/tools/bionicbb/__init__.py b/tools/bionicbb/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tools/bionicbb/__init__.py
+++ /dev/null
diff --git a/tools/bionicbb/build_listener.py b/tools/bionicbb/build_listener.py
index 3a0032d..b63c18d 100644
--- a/tools/bionicbb/build_listener.py
+++ b/tools/bionicbb/build_listener.py
@@ -5,7 +5,7 @@ import json
import requests
import termcolor
-import bionicbb.gerrit
+import gerrit
from flask import Flask, request
app = Flask(__name__)
@@ -79,7 +79,7 @@ def drop_rejection():
patch_set = revision_info['patchset']
bb_email = 'bionicbb@android.com'
- labels = bionicbb.gerrit.get_labels(change_id, patch_set)
+ labels = gerrit.get_labels(change_id, patch_set)
if bb_email in labels['Verified']:
bb_review = labels['Verified'][bb_email]
else:
diff --git a/tools/bionicbb/gmail_listener.py b/tools/bionicbb/gmail_listener.py
index 795efd8..95ae3ae 100644
--- a/tools/bionicbb/gmail_listener.py
+++ b/tools/bionicbb/gmail_listener.py
@@ -15,8 +15,8 @@ import time
import apiclient.errors
-import bionicbb.config
-import bionicbb.gerrit
+import config
+import gerrit
class GmailError(RuntimeError):
@@ -48,8 +48,7 @@ def build_service():
STORAGE = Storage('oauth.storage')
# Start the OAuth flow to retrieve credentials
- flow = flow_from_clientsecrets(bionicbb.config.client_secret_file,
- scope=OAUTH_SCOPE)
+ flow = flow_from_clientsecrets(config.client_secret_file, scope=OAUTH_SCOPE)
http = httplib2.Http()
# Try to retrieve credentials from storage or run the flow to generate them
@@ -92,9 +91,9 @@ def get_gerrit_info(body):
def clean_project(gerrit_info, dry_run):
- username = bionicbb.config.jenkins_credentials['username']
- password = bionicbb.config.jenkins_credentials['password']
- jenkins_url = bionicbb.config.jenkins_url
+ username = config.jenkins_credentials['username']
+ password = config.jenkins_credentials['password']
+ jenkins_url = config.jenkins_url
jenkins = jenkinsapi.api.Jenkins(jenkins_url, username, password)
build = 'clean-bionic-presubmit'
@@ -127,9 +126,9 @@ def build_project(gerrit_info, dry_run):
'platform/external/compiler-rt': 'bionic-presubmit',
}
- username = bionicbb.config.jenkins_credentials['username']
- password = bionicbb.config.jenkins_credentials['password']
- jenkins_url = bionicbb.config.jenkins_url
+ username = config.jenkins_credentials['username']
+ password = config.jenkins_credentials['password']
+ jenkins_url = config.jenkins_url
jenkins = jenkinsapi.api.Jenkins(jenkins_url, username, password)
project = gerrit_info['Project']
@@ -151,8 +150,8 @@ def build_project(gerrit_info, dry_run):
project_path)
return False
try:
- ref = bionicbb.gerrit.ref_for_change(change_id)
- except bionicbb.gerrit.GerritError as ex:
+ ref = gerrit.ref_for_change(change_id)
+ except gerrit.GerritError as ex:
print '{}({}): {} {}'.format(
termcolor.colored('GERRIT-ERROR', 'red'),
ex.code,
@@ -197,7 +196,7 @@ def drop_rejection(gerrit_info, dry_run):
'changeid': gerrit_info['Change-Id'],
'patchset': gerrit_info['PatchSet']
}
- url = '{}/{}'.format(bionicbb.config.build_listener_url, 'drop-rejection')
+ url = '{}/{}'.format(config.build_listener_url, 'drop-rejection')
headers = {'Content-Type': 'application/json;charset=UTF-8'}
if not dry_run:
try: