0

Use vpython's pyobjc wheel for color_profile_manager_mac.

This reverts commit 4eeae7ba49 and adds
the pyobjc wheel to Chromium's root .vpython. At this point, vpython
is used on all of the bots for the system Python, so it should be
suitably warmed up before getting into any of Chromium's tests.

Bug: 776804, 804174
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I35c602ca6e0368532685ae8afc3139692a6153fa
Reviewed-on: https://chromium-review.googlesource.com/954704
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541740}
This commit is contained in:
Kenneth Russell
2018-03-08 06:34:17 +00:00
committed by Commit Bot
parent 300cd0df11
commit c4782ec17d
4 changed files with 37 additions and 52 deletions

@ -163,3 +163,14 @@ wheel: <
platform: "manylinux1_x86_64"
>
>
# Used by:
# content/test/gpu/gpu_tests/color_profile_manager_mac.py
# Note: there's a version of this wheel for even older OS versions,
# but we don't need it for the GPU tests, and it looks like there are
# bugs in the not_match_tag implementation.
wheel: <
name: "infra/python/wheels/pyobjc/${vpython_platform}"
version: "version:4.1"
match_tag: < platform: "macosx_10_10_intel" >
>

@ -2,16 +2,34 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import atexit
import sys
IMPL_PY = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(
__file__))), 'utilities', 'color_profile_manager_impl.py')
has_forced_srgb = False
# Force all displays to use an sRGB color profile. By default, restore
# them at exit.
def ForceUntilExitSRGB(skip_restoring_color_profile=False):
global has_forced_srgb
if not sys.platform.startswith('darwin'):
return
# The Mac-specific Python packages used by the other scripts are only
# available via the system-installed Python.
subprocess.call(['/usr/bin/python', IMPL_PY])
if has_forced_srgb:
return
has_forced_srgb = True
from gpu_tests import color_profile_manager_mac
# Record the current color profiles.
display_profile_url_map = \
color_profile_manager_mac.GetDisplaysToProfileURLMap()
# Force to sRGB.
for display_id in display_profile_url_map:
color_profile_manager_mac.SetDisplayCustomProfile(
display_id, color_profile_manager_mac.GetSRGBProfileURL())
# Register an atexit handler to restore the previous color profiles.
def Restore():
if skip_restoring_color_profile:
print "Skipping restoring the original color profile"
return
for display_id in display_profile_url_map:
color_profile_manager_mac.SetDisplayCustomProfile(
display_id, display_profile_url_map[display_id])
atexit.register(Restore)

@ -1,44 +0,0 @@
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import atexit
import sys
has_forced_srgb = False
# Force all displays to use an sRGB color profile. By default, restore
# them at exit.
def ForceUntilExitSRGB(skip_restoring_color_profile=False):
global has_forced_srgb
if not sys.platform.startswith('darwin'):
return
if has_forced_srgb:
return
has_forced_srgb = True
import color_profile_manager_mac
# Record the current color profiles.
display_profile_url_map = \
color_profile_manager_mac.GetDisplaysToProfileURLMap()
# Force to sRGB.
for display_id in display_profile_url_map:
color_profile_manager_mac.SetDisplayCustomProfile(
display_id, color_profile_manager_mac.GetSRGBProfileURL())
# Register an atexit handler to restore the previous color profiles.
def Restore():
if skip_restoring_color_profile:
print "Skipping restoring the original color profile"
return
for display_id in display_profile_url_map:
color_profile_manager_mac.SetDisplayCustomProfile(
display_id, display_profile_url_map[display_id])
atexit.register(Restore)
# If invoked as a top-level script, assume that we want to run
# ForceUntilExitSRGB with skip_restoring_color_profile=True (which is
# what all the tests in this directory want).
def main():
ForceUntilExitSRGB(skip_restoring_color_profile=True)
if __name__ == '__main__':
sys.exit(main())