OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2008 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2008 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Platform-specific utility methods shared by several scripts.""" | 6 """Platform-specific utility methods shared by several scripts.""" |
7 | 7 |
8 import os | 8 import os |
9 import re | 9 import re |
10 import subprocess | 10 import subprocess |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 use_http=True, | 86 use_http=True, |
87 use_ssl=use_ssl, | 87 use_ssl=use_ssl, |
88 port=port) | 88 port=port) |
89 | 89 |
90 # Run off file:// | 90 # Run off file:// |
91 return PlatformUtility._FilenameToUri(self, full_path, use_http=False, | 91 return PlatformUtility._FilenameToUri(self, full_path, use_http=False, |
92 use_ssl=False, port=0) | 92 use_ssl=False, port=0) |
93 | 93 |
94 def LigHTTPdExecutablePath(self): | 94 def LigHTTPdExecutablePath(self): |
95 """Returns the executable path to start LigHTTPd""" | 95 """Returns the executable path to start LigHTTPd""" |
96 return PathFromBase('third_party', 'lighttpd', 'linux', 'bin', 'lighttpd') | 96 binpath = "/usr/sbin/lighttpd" |
97 if os.path.exists(binpath): | |
98 return binpath | |
99 print "Unable to find LigHTTPd executable %s" % binpath | |
100 print 'Please install lighttpd/php using "sudo apt-get install lighttpd php5 cgi"' | |
tony
2008/11/18 20:49:25
Nit: 80 col (see two others below).
| |
101 sys.exit(1) | |
97 | 102 |
98 def LigHTTPdModulePath(self): | 103 def LigHTTPdModulePath(self): |
99 """Returns the library module path for LigHTTPd""" | 104 """Returns the library module path for LigHTTPd""" |
100 return PathFromBase('third_party', 'lighttpd', 'linux', 'lib') | 105 modpath = "/usr/lib/lighttpd" |
106 if os.path.exists(modpath): | |
107 return modpath | |
108 print "Unable to find LigHTTPd modules %s" % modpath | |
109 print 'Please install lighttpd/php using "sudo apt-get install lighttpd php5 cgi"' | |
110 sys.exit(1) | |
101 | 111 |
102 def LigHTTPdPHPPath(self): | 112 def LigHTTPdPHPPath(self): |
103 """Returns the PHP executable path for LigHTTPd""" | 113 """Returns the PHP executable path for LigHTTPd""" |
104 return PathFromBase('third_party', 'lighttpd', 'linux', 'bin', 'php-cgi') | 114 binpath = "/usr/bin/php-cgi" |
115 if os.path.exists(binpath): | |
116 return binpath | |
117 print "Unable to find PHP CGI executable %s" % binpath | |
118 print 'Please install lighttpd/php using "sudo apt-get install lighttpd php5 cgi"' | |
119 sys.exit(1) | |
105 | 120 |
106 def ShutDownHTTPServer(self, server_process): | 121 def ShutDownHTTPServer(self, server_process): |
107 """Shut down the lighttpd web server. Blocks until it's fully shut down. | 122 """Shut down the lighttpd web server. Blocks until it's fully shut down. |
108 | 123 |
109 Args: | 124 Args: |
110 server_process: The subprocess object representing the running server | 125 server_process: The subprocess object representing the running server |
111 """ | 126 """ |
112 subprocess.Popen(('kill', '-TERM', '%d' % server_process.pid), | 127 subprocess.Popen(('kill', '-TERM', '%d' % server_process.pid), |
113 stdout=subprocess.PIPE, | 128 stdout=subprocess.PIPE, |
114 stderr=subprocess.PIPE).wait() | 129 stderr=subprocess.PIPE).wait() |
(...skipping 21 matching lines...) Expand all Loading... | |
136 | 151 |
137 def TestListPlatformDir(self): | 152 def TestListPlatformDir(self): |
138 """Return the platform-specific directory for where the test lists live""" | 153 """Return the platform-specific directory for where the test lists live""" |
139 return 'linux' | 154 return 'linux' |
140 | 155 |
141 def PlatformDir(self): | 156 def PlatformDir(self): |
142 """Returns the most specific directory name where platform-specific | 157 """Returns the most specific directory name where platform-specific |
143 results live. | 158 results live. |
144 """ | 159 """ |
145 return 'chromium-linux' | 160 return 'chromium-linux' |
OLD | NEW |