Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1563)

Unified Diff: Tools/Scripts/webkitpy/common/system/platforminfo.py

Issue 1201873002: Move LayoutTest Linux distribution detection to PlatformInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove crusty comment Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Tools/Scripts/webkitpy/common/system/platforminfo.py
diff --git a/Tools/Scripts/webkitpy/common/system/platforminfo.py b/Tools/Scripts/webkitpy/common/system/platforminfo.py
index 6a7f7aa3ceaee56fedd40b270f5d7456a9b72156..e43ada1a5ed6c383a69548956697563a218aaf67 100644
--- a/Tools/Scripts/webkitpy/common/system/platforminfo.py
+++ b/Tools/Scripts/webkitpy/common/system/platforminfo.py
@@ -43,8 +43,9 @@ class PlatformInfo(object):
newer than one known to the code.
"""
- def __init__(self, sys_module, platform_module, executive):
+ def __init__(self, sys_module, platform_module, filesystem_module, executive):
self._executive = executive
+ self._filesystem = filesystem_module
self._platform_module = platform_module
self.os_name = self._determine_os_name(sys_module.platform)
if self.os_name == 'linux':
@@ -119,6 +120,19 @@ class PlatformInfo(object):
except:
return sys.maxint
+ def linux_distribution(self):
+ if not self.is_linux():
+ return None
+
+ if self._filesystem.exists('/etc/redhat-release'):
+ return 'redhat'
+ if self._filesystem.exists('/etc/debian_version'):
+ return 'debian'
+ if self._filesystem.exists('/etc/arch-release'):
+ return 'arch'
+
+ return 'unknown'
+
def _determine_os_name(self, sys_platform):
if sys_platform == 'darwin':
return 'mac'
« no previous file with comments | « LayoutTests/http/conf/redhat-httpd-2.4.conf ('k') | Tools/Scripts/webkitpy/common/system/platforminfo_mock.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698