Use os.path directly rather than sometimes importing it separately.
(imported from commit 48486c4ea64d02a15faeebb0f490d31e9b113d62)
This commit is contained in:
parent
491d21302c
commit
6894453ab5
|
@ -4,10 +4,9 @@ import sys
|
|||
import time
|
||||
import optparse
|
||||
from collections import defaultdict
|
||||
import os
|
||||
|
||||
from os import path, environ
|
||||
|
||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
from zulip_tools import check_output
|
||||
|
||||
states = {
|
||||
|
@ -17,7 +16,7 @@ states = {
|
|||
3: "UNKNOWN"
|
||||
}
|
||||
|
||||
if 'USER' in environ and not environ['USER'] in ['root', 'rabbitmq']:
|
||||
if 'USER' in os.environ and not os.environ['USER'] in ['root', 'rabbitmq']:
|
||||
print "This script must be run as the root or rabbitmq user"
|
||||
|
||||
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
import sys
|
||||
import re
|
||||
import time
|
||||
import os
|
||||
|
||||
from os import path, environ
|
||||
|
||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
from zulip_tools import check_output
|
||||
|
||||
WARN_THRESHOLD = 50
|
||||
|
@ -26,7 +25,7 @@ status = 0
|
|||
max_count = 0
|
||||
warn_queues = []
|
||||
|
||||
if 'USER' in environ and not environ['USER'] in ['root', 'rabbitmq']:
|
||||
if 'USER' in os.environ and not os.environ['USER'] in ['root', 'rabbitmq']:
|
||||
print "This script must be run as the root or rabbitmq user"
|
||||
|
||||
for line in output.split("\n"):
|
||||
|
|
|
@ -6,9 +6,9 @@ import optparse
|
|||
import urlparse
|
||||
import itertools
|
||||
import traceback
|
||||
from os import path
|
||||
import os
|
||||
|
||||
sys.path.append(path.join(path.dirname(__file__), '../api'))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '../api'))
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(r"""
|
||||
|
@ -57,7 +57,7 @@ except ImportError:
|
|||
|
||||
def get_calendar_url():
|
||||
parts = urlparse.urlparse(options.calendar)
|
||||
pat = path.split(parts.path)
|
||||
pat = os.path.split(parts.path)
|
||||
if pat[1] != 'basic':
|
||||
parser.error('The --calendar URL should be the XML "Private Address" ' +
|
||||
'from your calendar settings')
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#!/usr/bin/env python
|
||||
import sys
|
||||
from os import path
|
||||
import os
|
||||
import logging
|
||||
import time
|
||||
import simplejson
|
||||
import subprocess
|
||||
import unicodedata
|
||||
|
||||
sys.path.append(path.join(path.dirname(__file__), '..', 'api'))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'api'))
|
||||
import zulip
|
||||
|
||||
zulip_client = zulip.Client()
|
||||
|
|
|
@ -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'],))
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# THE SOFTWARE.
|
||||
|
||||
import sys
|
||||
from os import path
|
||||
import os
|
||||
import optparse
|
||||
|
||||
usage = """edit-message [options] --message=<msg_id> --subject=<new subject> --content=<new content> --user=<sender's email address> --api-key=<sender's api key>
|
||||
|
@ -34,7 +34,7 @@ Example: edit-message --message-id="348135" --subject="my subject" --content="te
|
|||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||
"""
|
||||
|
||||
sys.path.insert(0, path.join(path.dirname(__file__), '..'))
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# THE SOFTWARE.
|
||||
|
||||
import sys
|
||||
from os import path
|
||||
import os
|
||||
import optparse
|
||||
|
||||
usage = """get-public-streams --user=<bot's email address> --api-key=<bot's api key> [options]
|
||||
|
@ -34,7 +34,7 @@ Example: get-public-streams --user=othello-bot@example.com --api-key=a0b1c2d3e4f
|
|||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||
"""
|
||||
|
||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# THE SOFTWARE.
|
||||
|
||||
import sys
|
||||
from os import path
|
||||
import os
|
||||
import optparse
|
||||
|
||||
usage = """list-members --user=<bot's email address> --api-key=<bot's api key> [options]
|
||||
|
@ -32,7 +32,7 @@ List the names and e-mail addresses of the people in your realm.
|
|||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||
"""
|
||||
|
||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# THE SOFTWARE.
|
||||
|
||||
import sys
|
||||
from os import path
|
||||
import os
|
||||
import optparse
|
||||
|
||||
usage = """list-subscriptions --user=<bot's email address> --api-key=<bot's api key> [options]
|
||||
|
@ -33,7 +33,7 @@ Example: list-subscriptions --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c
|
|||
|
||||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||
"""
|
||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# THE SOFTWARE.
|
||||
|
||||
import sys
|
||||
from os import path
|
||||
import os
|
||||
import optparse
|
||||
|
||||
usage = """print-messages --user=<bot's email address> --api-key=<bot's api key> [options]
|
||||
|
@ -33,7 +33,7 @@ Example: print-messages --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e
|
|||
|
||||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||
"""
|
||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# THE SOFTWARE.
|
||||
|
||||
import sys
|
||||
from os import path
|
||||
import os
|
||||
import optparse
|
||||
|
||||
usage = """print-next-message --user=<bot's email address> --api-key=<bot's api key> [options]
|
||||
|
@ -33,7 +33,7 @@ Example: print-next-messages --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7
|
|||
|
||||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||
"""
|
||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
# THE SOFTWARE.
|
||||
|
||||
import sys
|
||||
from os import path
|
||||
import os
|
||||
import optparse
|
||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import zulip
|
||||
|
||||
usage = """send-message --user=<bot's email address> --api-key=<bot's api key> [options] <recipients>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# THE SOFTWARE.
|
||||
|
||||
import sys
|
||||
from os import path
|
||||
import os
|
||||
import optparse
|
||||
|
||||
usage = """subscribe --user=<bot's email address> --api-key=<bot's api key> [options] --streams=<streams>
|
||||
|
@ -34,7 +34,7 @@ Examples: subscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f1a
|
|||
|
||||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||
"""
|
||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
# THE SOFTWARE.
|
||||
|
||||
import sys
|
||||
from os import path
|
||||
import os
|
||||
import optparse
|
||||
|
||||
usage = """unsubscribe --user=<bot's email address> --api-key=<bot's api key> [options] --streams=<streams>
|
||||
|
@ -34,7 +34,7 @@ Examples: unsubscribe --user=tabbott@zulip.com --api-key=a0b1c2d3e4f5a6b7c8d9e0f
|
|||
|
||||
You can omit --user and --api-key arguments if you have a properly set up ~/.zuliprc
|
||||
"""
|
||||
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
import zulip
|
||||
|
||||
parser = optparse.OptionParser(usage=usage)
|
||||
|
|
Loading…
Reference in a new issue