Meta: Move ladybird.py imports to the top of the file

There's no measurable benefit to hiding these in functions, even if they
are only used once (or not at all). Only the BuildVcpkg import is left
alone, as that function does some sys.path manipulation first.
This commit is contained in:
Timothy Flynn 2025-05-21 16:05:14 -04:00 committed by Andrew Kaster
commit 16feb0b979
Notes: github-actions[bot] 2025-05-21 22:57:29 +00:00

View file

@ -1,14 +1,17 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import argparse import argparse
import os
import re
import sys
import shutil
import multiprocessing import multiprocessing
from pathlib import Path import os
import platform
import re
import resource
import shutil
import subprocess import subprocess
import sys
from enum import IntEnum from enum import IntEnum
from pathlib import Path
class HostArchitecture(IntEnum): class HostArchitecture(IntEnum):
@ -26,8 +29,6 @@ class HostSystem(IntEnum):
class Platform: class Platform:
def __init__(self): def __init__(self):
import platform
self.system = platform.system() self.system = platform.system()
if self.system == "Windows": if self.system == "Windows":
self.host_system = HostSystem.Windows self.host_system = HostSystem.Windows
@ -250,8 +251,6 @@ def configure_main(platform, **kwargs):
def configure_skia_jemalloc(): def configure_skia_jemalloc():
import resource
page_size = resource.getpagesize() page_size = resource.getpagesize()
gn = shutil.which("gn") or None gn = shutil.which("gn") or None
# https://github.com/LadybirdBrowser/ladybird/issues/261 # https://github.com/LadybirdBrowser/ladybird/issues/261