import.py (1181B)
1 #! /usr/bin/env python3 2 # 3 # This Source Code Form is subject to the terms of the Mozilla Public 4 # License, v. 2.0. If a copy of the MPL was not distributed with this 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 7 assert __name__ == "__main__" 8 9 import shutil 10 import sys 11 from pathlib import Path 12 13 REL_PATH = "/dom/canvas/test/webgl-conf" 14 REPO_DIR = Path.cwd() 15 DIR_IN_GECKO = Path(__file__).parent 16 assert not REPO_DIR.samefile(DIR_IN_GECKO), ( 17 "Run this script from the source git checkout." 18 ) 19 assert DIR_IN_GECKO.as_posix().endswith(REL_PATH) # Be paranoid with rm -rf. 20 21 gecko_base_dir = DIR_IN_GECKO.as_posix()[: -len(REL_PATH)] 22 angle_dir = Path(gecko_base_dir, "gfx/angle").as_posix() 23 sys.path.append(angle_dir) 24 from vendor_from_git import print_now, record_cherry_picks 25 26 # -- 27 28 (MERGE_BASE_ORIGIN,) = sys.argv[1:] # Not always 'origin'! 29 record_cherry_picks(DIR_IN_GECKO, MERGE_BASE_ORIGIN) 30 31 # -- 32 33 src_dir = Path(REPO_DIR, "sdk/tests") 34 dest_dir = Path(DIR_IN_GECKO, "checkout") 35 print_now("Nuking old checkout...") 36 shutil.rmtree(dest_dir, True) 37 print_now("Writing new checkout...") 38 shutil.copytree(src_dir, dest_dir, copy_function=shutil.copy) 39 40 print_now("Done!")