提交 1e9fc192 编写于 作者: E Eric Seidel

Fix sky_server.py on Mac and make sky_server executable if it's not already

R=eseidel@chromium.org, eseidel

Review URL: https://codereview.chromium.org/1161133002
上级 e1de4707
...@@ -6,6 +6,7 @@ import socket ...@@ -6,6 +6,7 @@ import socket
import subprocess import subprocess
import logging import logging
import os.path import os.path
import stat
import platform import platform
SKYPY_PATH = os.path.dirname(os.path.abspath(__file__)) SKYPY_PATH = os.path.dirname(os.path.abspath(__file__))
...@@ -32,10 +33,10 @@ class SkyServer(object): ...@@ -32,10 +33,10 @@ class SkyServer(object):
if platform.system() == 'Linux': if platform.system() == 'Linux':
platform_dir = 'linux64' platform_dir = 'linux64'
elif platform.system() == 'Mac': elif platform.system() == 'Darwin':
platform_dir = 'mac' platform_dir = 'mac'
else: else:
assert False, 'No sky_server binary for this platform?' assert False, 'No sky_server binary for this platform: ' + platform.system()
return os.path.join(SKYGO_PATH, platform_dir, 'sky_server') return os.path.join(SKYGO_PATH, platform_dir, 'sky_server')
...@@ -47,6 +48,10 @@ class SkyServer(object): ...@@ -47,6 +48,10 @@ class SkyServer(object):
return return
server_path = self.sky_server_path() server_path = self.sky_server_path()
st = os.stat(self.sky_server_path())
if not (stat.S_IXUSR & st[stat.ST_MODE]):
logging.warn('Changing the permissions of %s to be executable.', self.sky_server_path())
os.chmod(self.sky_server_path(), st[stat.ST_MODE] | stat.S_IEXEC)
server_command = [ server_command = [
server_path, server_path,
'-t', self.configuration, '-t', self.configuration,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册