Summary: | webkitpy: platforminfo should replace direct checks for sys.platform wherever possible | ||
---|---|---|---|
Product: | WebKit | Reporter: | Raphael Kubo da Costa (:rakuco) <rakuco> |
Component: | Tools / Tests | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW --- | ||
Severity: | Normal | CC: | abarth, basuke, dpranke, rniwa |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Bug Depends on: | 85407, 180827 | ||
Bug Blocks: |
Description
Raphael Kubo da Costa (:rakuco)
2012-03-19 14:02:07 PDT
This is a fair observation, but I'm not sure how this will really pan out in practice. Do you have specific examples in mind where we can do feature testing rather than platform testing? Not right now, really. What I've been doing these days is: 1. Try to clean up some uses of sys.platform 2. Convert checks for "darwin" to PlatformInfo.is_mac(), then do the same for PlatformInfo.is_win() 3. Add is_win32() and is_cygwin() to PlatformInfo and make is_win() return `self.is_win32() or self.is_cygwin()'. After that comes the tricky part of replacing the pieces of code which only check for "cygwin" or "win32" -- I'm not sure how to approach this, but when we talked on IRC about this issue (it all started because I'd like webkitpy to support FreeBSD and the current approach in bug 81467 is too intrusive) we thought of adding some kind of "is_unix" or "is_nix" to PlatformInfo. Right now I'm considering making this method just return something like `is_linux() or is_foo() or is_bar()', but this is where feature checks would come handy as well. I agree with this separation. Let's do it. ... OMG this one is five years old bug :( I see many similar platform check on Executive so I tried to replace them using PlatformInfo, but I couldn't because PlatformInfo is dependent on executive and it requires executive on its __init__(). This kind of situation also should be solved. |