Changeset 56336 in webkit


Ignore:
Timestamp:
Mar 22, 2010 9:24:32 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-22 Chris Jerdonek <Chris Jerdonek>

Reviewed by Adam Barth.

Refactored the cpu_count() code in executive.py.

https://bugs.webkit.org/show_bug.cgi?id=36437

  • Scripts/webkitpy/executive.py:
    • Moved the import of the multiprocessing module to the top of the file rather than importing from within a function.
Location:
trunk/WebKitTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r56335 r56336  
     12010-03-22  Chris Jerdonek  <cjerdonek@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Refactored the cpu_count() code in executive.py.
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=36437
     8
     9        * Scripts/webkitpy/executive.py:
     10          - Moved the import of the multiprocessing module to the top
     11            of the file rather than importing from within a function.
     12
    1132010-03-22 Antonio Gomes <tonikitoo@webkit.org>
    214
  • trunk/WebKitTools/Scripts/webkitpy/executive.py

    r53896 r56336  
    2727# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    2828# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29
     30try:
     31    # This API exists only in Python 2.6 and higher.  :(
     32    import multiprocessing
     33except ImportError:
     34    multiprocessing = None
    2935
    3036import os
     
    114120    @staticmethod
    115121    def cpu_count():
    116         # This API exists only in Python 2.6 and higher.  :(
    117         try:
    118             import multiprocessing
     122        if multiprocessing:
    119123            return multiprocessing.cpu_count()
    120         except (ImportError, NotImplementedError):
    121             # This quantity is a lie but probably a reasonable guess for modern
    122             # machines.
    123             return 2
     124        # This quantity is a lie but probably a reasonable guess for modern
     125        # machines.
     126        return 2
    124127
    125128    # Error handlers do not need to be static methods once all callers are
Note: See TracChangeset for help on using the changeset viewer.