zephyr_mirror: Use os.path.join for constructing the root_path.

(imported from commit d894ab68430e42233a7aa6b289f01e790f8c8586)
This commit is contained in:
Tim Abbott 2012-11-07 15:37:46 -05:00
parent 1e50224ca2
commit 6caf52867f

View file

@ -158,9 +158,9 @@ def update_subscriptions_from_humbug():
ensure_subscribed(stream) ensure_subscribed(stream)
def maybe_restart_mirroring_script(): def maybe_restart_mirroring_script():
if os.stat(options.root_path + "/stamps/restart_stamp").st_mtime > start_time or \ if os.stat(os.path.join(options.root_path, "stamps", "restart_stamp")).st_mtime > start_time or \
((options.user == "tabbott" or options.user == "tabbott/extra") and ((options.user == "tabbott" or options.user == "tabbott/extra") and
os.stat(options.root_path + "/stamps/tabbott_stamp").st_mtime > start_time): os.stat(os.path.join(options.root_path, "stamps", "tabbott_stamp")).st_mtime > start_time):
print print
print "%s: zephyr mirroring script has been updated; restarting..." % \ print "%s: zephyr mirroring script has been updated; restarting..." % \
(datetime.datetime.now()) (datetime.datetime.now())
@ -168,8 +168,8 @@ def maybe_restart_mirroring_script():
while True: while True:
try: try:
if bot_name == "extra_mirror.py": if bot_name == "extra_mirror.py":
os.execvp(options.root_path + "/extra_mirror.py", sys.argv) os.execvp(os.path.join(options.root_path, "extra_mirror.py"), sys.argv)
os.execvp(options.root_path + "/user_root/zephyr_mirror.py", sys.argv) os.execvp(os.path.join(options.root_path, "user_root", "zephyr_mirror.py"), sys.argv)
except: except:
print "Error restarting, trying again." print "Error restarting, trying again."
traceback.print_exc() traceback.print_exc()
@ -595,8 +595,8 @@ if __name__ == "__main__":
action='store') action='store')
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
sys.path[:0] = [options.root_path, options.root_path + "/python-zephyr", sys.path[:0] = [options.root_path, os.path.join(options.root_path, "python-zephyr"),
options.root_path + "/python-zephyr/build/lib.linux-x86_64-2.6/"] os.path.join(options.root_path, "python-zephyr/build/lib.linux-x86_64-2.6/")]
# In case this is an automated restart of the mirroring script, # In case this is an automated restart of the mirroring script,
# and we have lost AFS tokens, first try reading the API key from # and we have lost AFS tokens, first try reading the API key from