| OLD | NEW |
| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(steveblock): There's no longer any need to pass '--platform | 102 # FIXME(steveblock): There's no longer any need to pass '--platform |
| 103 # chromium' on the command line so we can remove this logic. | 103 # chromium' on the command line so we can remove this logic. |
| 104 if port_name == 'chromium': | 104 if port_name == 'chromium': |
| 105 port_name = self._host.platform.os_name | 105 port_name = self._host.platform.os_name |
| 106 | 106 |
| 107 if 'browser_test' in port_name: | 107 for port_class in self.PORT_CLASSES: |
| 108 module_name, class_name = port_name.rsplit('.', 1) | 108 module_name, class_name = port_class.rsplit('.', 1) |
| 109 module = __import__(module_name, globals(), locals(), [], -1) | 109 module = __import__(module_name, globals(), locals(), [], -1) |
| 110 port_class_name = module.get_port_class_name(class_name) | 110 cls = module.__dict__[class_name] |
| 111 if port_class_name != None: | 111 if port_name.startswith(cls.port_name): |
| 112 cls = module.__dict__[port_class_name] | 112 port_name = cls.determine_full_port_name(self._host, options, po
rt_name) |
| 113 port_name = cls.determine_full_port_name(self._host, options, cl
ass_name) | |
| 114 return cls(self._host, port_name, options=options, **kwargs) | 113 return cls(self._host, port_name, options=options, **kwargs) |
| 115 else: | |
| 116 for port_class in self.PORT_CLASSES: | |
| 117 module_name, class_name = port_class.rsplit('.', 1) | |
| 118 module = __import__(module_name, globals(), locals(), [], -1) | |
| 119 cls = module.__dict__[class_name] | |
| 120 if port_name.startswith(cls.port_name): | |
| 121 port_name = cls.determine_full_port_name(self._host, options
, port_name) | |
| 122 return cls(self._host, port_name, options=options, **kwargs) | |
| 123 raise NotImplementedError('unsupported platform: "%s"' % port_name) | 114 raise NotImplementedError('unsupported platform: "%s"' % port_name) |
| 124 | 115 |
| 125 def all_port_names(self, platform=None): | 116 def all_port_names(self, platform=None): |
| 126 """Return a list of all valid, fully-specified, "real" port names. | 117 """Return a list of all valid, fully-specified, "real" port names. |
| 127 | 118 |
| 128 This is the list of directories that are used as actual baseline_paths() | 119 This is the list of directories that are used as actual baseline_paths() |
| 129 by real ports. This does not include any "fake" names like "test" | 120 by real ports. This does not include any "fake" names like "test" |
| 130 or "mock-mac", and it does not include any directories that are not. | 121 or "mock-mac", and it does not include any directories that are not. |
| 131 | 122 |
| 132 If platform is not specified, we will glob-match all ports""" | 123 If platform is not specified, we will glob-match all ports""" |
| 133 platform = platform or '*' | 124 platform = platform or '*' |
| 134 return fnmatch.filter(builders.all_port_names(), platform) | 125 return fnmatch.filter(builders.all_port_names(), platform) |
| 135 | 126 |
| 136 def get_from_builder_name(self, builder_name): | 127 def get_from_builder_name(self, builder_name): |
| 137 port_name = builders.port_name_for_builder_name(builder_name) | 128 port_name = builders.port_name_for_builder_name(builder_name) |
| 138 assert port_name, "unrecognized builder name '%s'" % builder_name | 129 assert port_name, "unrecognized builder name '%s'" % builder_name |
| 139 return self.get(port_name, _builder_options(builder_name)) | 130 return self.get(port_name, _builder_options(builder_name)) |
| OLD | NEW |