Makefile: run-pw with launcher

Build and copy the launcher when testing Playwright
This commit is contained in:
daijro 2024-08-13 21:20:19 -05:00
parent 0be654bbe9
commit ad87cec317
2 changed files with 9 additions and 2 deletions

View file

@ -138,6 +138,7 @@ package-windows:
--fonts macos linux --fonts macos linux
run-pw: run-pw:
make build-launcher arch=x86_64 os=linux;
python3 scripts/run-pw.py \ python3 scripts/run-pw.py \
--version $(version) \ --version $(version) \
--release $(release) --release $(release)
@ -145,4 +146,4 @@ run-pw:
run: run:
cd $(cf_source_dir) && rm -rf ~/.camoufox && ./mach run cd $(cf_source_dir) && rm -rf ~/.camoufox && ./mach run
vcredist_arch := $(shell echo $(arch) | sed 's/x86_64/x64/' | sed 's/i686/x86/') vcredist_arch := $(shell echo $(arch) | sed 's/x86_64/x64/' | sed 's/i686/x86/')

View file

@ -1,5 +1,6 @@
import argparse import argparse
import os import os
import shutil
import time import time
from _mixin import find_src_dir, get_moz_target, temp_cd from _mixin import find_src_dir, get_moz_target, temp_cd
@ -39,12 +40,17 @@ def main():
src_dir = find_src_dir('.', args.version, args.release) src_dir = find_src_dir('.', args.version, args.release)
moz_target = get_moz_target(target='linux', arch='x86_64') moz_target = get_moz_target(target='linux', arch='x86_64')
launcher_path = os.path.abspath(os.path.join('.', 'launcher', 'dist', 'launch'))
with temp_cd(src_dir): with temp_cd(src_dir):
print(f'Looking for file: obj-{moz_target}/dist/bin/camoufox-bin') print(f'Looking for file: obj-{moz_target}/dist/bin/camoufox-bin')
with temp_cd(f'obj-{moz_target}/dist/bin'): with temp_cd(f'obj-{moz_target}/dist/bin'):
if os.path.exists('camoufox-bin'): if os.path.exists('camoufox-bin'):
file_name = 'camoufox-bin' # Copy launcher_path to . if we are using camoufox-bin
shutil.copy(launcher_path, '.')
file_name = 'launch'
elif os.path.exists('firefox-bin'): elif os.path.exists('firefox-bin'):
# Or else just use firefox-bin
file_name = 'firefox-bin' file_name = 'firefox-bin'
else: else:
raise FileNotFoundError(f'Binary not found: obj-{moz_target}/dist/bin') raise FileNotFoundError(f'Binary not found: obj-{moz_target}/dist/bin')