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

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/port/factory.py

Issue 16917002: Rename chromium-win* ports to win* (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 is_webkit2 = builder_name.find("WK2") != -1 68 is_webkit2 = builder_name.find("WK2") != -1
69 builder_name = builder_name 69 builder_name = builder_name
70 return optparse.Values({'builder_name': builder_name, 'configuration': confi guration}) 70 return optparse.Values({'builder_name': builder_name, 'configuration': confi guration})
71 71
72 72
73 class PortFactory(object): 73 class PortFactory(object):
74 PORT_CLASSES = ( 74 PORT_CLASSES = (
75 'chromium_android.ChromiumAndroidPort', 75 'chromium_android.ChromiumAndroidPort',
76 'chromium_linux.ChromiumLinuxPort', 76 'chromium_linux.ChromiumLinuxPort',
77 'chromium_mac.ChromiumMacPort', 77 'chromium_mac.ChromiumMacPort',
78 'chromium_win.ChromiumWinPort', 78 'win.WinPort',
79 'mock_drt.MockDRTPort', 79 'mock_drt.MockDRTPort',
80 'test.TestPort', 80 'test.TestPort',
81 ) 81 )
82 82
83 def __init__(self, host): 83 def __init__(self, host):
84 self._host = host 84 self._host = host
85 85
86 def _default_port(self, options): 86 def _default_port(self, options):
87 platform = self._host.platform 87 platform = self._host.platform
88 if platform.is_linux() or platform.is_freebsd(): 88 if platform.is_linux() or platform.is_freebsd():
89 return 'chromium-linux' 89 return 'chromium-linux'
90 elif platform.is_mac(): 90 elif platform.is_mac():
91 return 'chromium-mac' 91 return 'chromium-mac'
92 elif platform.is_win(): 92 elif platform.is_win():
93 return 'chromium-win' 93 return 'win'
94 raise NotImplementedError('unknown platform: %s' % platform) 94 raise NotImplementedError('unknown platform: %s' % platform)
95 95
96 def get(self, port_name=None, options=None, **kwargs): 96 def get(self, port_name=None, options=None, **kwargs):
97 """Returns an object implementing the Port interface. If 97 """Returns an object implementing the Port interface. If
98 port_name is None, this routine attempts to guess at the most 98 port_name is None, this routine attempts to guess at the most
99 appropriate port on this platform.""" 99 appropriate port on this platform."""
100 port_name = port_name or self._default_port(options) 100 port_name = port_name or self._default_port(options)
101 101
102 # FIXME(dpranke): We special-case '--platform chromium' so that it can c o-exist 102 # FIXME(dpranke): We special-case '--platform chromium' so that it can c o-exist
103 # with '--platform chromium-mac' and '--platform chromium-linux' properl y (we 103 # with '--platform chromium-mac' and '--platform chromium-linux' properl y (we
104 # can't look at the port_name prefix in this case). 104 # can't look at the port_name prefix in this case).
105 if port_name == 'chromium': 105 if port_name == 'chromium':
106 port_name = 'chromium-' + self._host.platform.os_name 106 # FIXME(steveblock): This hack will go away once all ports have
107 # been renamed to remove the 'chromium-' part.
108 if self._host.platform.os_name == 'win':
109 port_name = 'win'
110 else:
111 port_name = 'chromium-' + self._host.platform.os_name
107 112
108 for port_class in self.PORT_CLASSES: 113 for port_class in self.PORT_CLASSES:
109 module_name, class_name = port_class.rsplit('.', 1) 114 module_name, class_name = port_class.rsplit('.', 1)
110 module = __import__(module_name, globals(), locals(), [], -1) 115 module = __import__(module_name, globals(), locals(), [], -1)
111 cls = module.__dict__[class_name] 116 cls = module.__dict__[class_name]
112 if port_name.startswith(cls.port_name): 117 if port_name.startswith(cls.port_name):
113 port_name = cls.determine_full_port_name(self._host, options, po rt_name) 118 port_name = cls.determine_full_port_name(self._host, options, po rt_name)
114 return cls(self._host, port_name, options=options, **kwargs) 119 return cls(self._host, port_name, options=options, **kwargs)
115 raise NotImplementedError('unsupported platform: "%s"' % port_name) 120 raise NotImplementedError('unsupported platform: "%s"' % port_name)
116 121
117 def all_port_names(self, platform=None): 122 def all_port_names(self, platform=None):
118 """Return a list of all valid, fully-specified, "real" port names. 123 """Return a list of all valid, fully-specified, "real" port names.
119 124
120 This is the list of directories that are used as actual baseline_paths() 125 This is the list of directories that are used as actual baseline_paths()
121 by real ports. This does not include any "fake" names like "test" 126 by real ports. This does not include any "fake" names like "test"
122 or "mock-mac", and it does not include any directories that are not. 127 or "mock-mac", and it does not include any directories that are not.
123 128
124 If platform is not specified, we will glob-match all ports""" 129 If platform is not specified, we will glob-match all ports"""
125 platform = platform or '*' 130 platform = platform or '*'
126 return fnmatch.filter(builders.all_port_names(), platform) 131 return fnmatch.filter(builders.all_port_names(), platform)
127 132
128 def get_from_builder_name(self, builder_name): 133 def get_from_builder_name(self, builder_name):
129 port_name = builders.port_name_for_builder_name(builder_name) 134 port_name = builders.port_name_for_builder_name(builder_name)
130 assert port_name, "unrecognized builder name '%s'" % builder_name 135 assert port_name, "unrecognized builder name '%s'" % builder_name
131 return self.get(port_name, _builder_options(builder_name)) 136 return self.get(port_name, _builder_options(builder_name))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698