Use os.path directly rather than sometimes importing it separately.

(imported from commit 48486c4ea64d02a15faeebb0f490d31e9b113d62)
This commit is contained in:
Tim Abbott 2013-10-28 10:54:32 -04:00
parent 491d21302c
commit 6894453ab5
14 changed files with 38 additions and 40 deletions

View file

@ -22,7 +22,7 @@
# SOFTWARE.
import sys
from os import path, environ
import os
# Configure this script as a Tddium post-build task and it will send
@ -42,26 +42,26 @@ from os import path, environ
# Here we assume it's in the parent of the directory
# where this script lives.
zulip_directory = path.join(path.dirname(__file__), '../api')
zulip_directory = os.path.join(os.path.dirname(__file__), '../api')
sys.path.append(zulip_directory)
import zulip
client = zulip.Client(
email = environ['ZULIP_USER'],
api_key = environ.get('ZULIP_API_KEY'))
email = os.environ['ZULIP_USER'],
api_key = os.environ.get('ZULIP_API_KEY'))
tddium_server = environ.get('TDDIUM_API_SERVER', 'api.tddium.com')
report_url = 'https://%s/1/reports/%s' % (tddium_server, environ['TDDIUM_SESSION_ID'])
repo_name = path.basename(environ['TDDIUM_REPO_ROOT'])
tddium_server = os.environ.get('TDDIUM_API_SERVER', 'api.tddium.com')
report_url = 'https://%s/1/reports/%s' % (tddium_server, os.environ['TDDIUM_SESSION_ID'])
repo_name = os.path.basename(os.environ['TDDIUM_REPO_ROOT'])
result = client.send_message(dict(
type = 'stream',
to = environ['ZULIP_STREAM'],
to = os.environ['ZULIP_STREAM'],
subject = 'build for ' + repo_name,
content = '%s [%s](%s)' %
(repo_name, environ['TDDIUM_BUILD_STATUS'], report_url)))
(repo_name, os.environ['TDDIUM_BUILD_STATUS'], report_url)))
if result['result'] != 'success':
sys.stderr.write('Error sending to Zulip:\n%s\n' % (result['msg'],))