-
-
Notifications
You must be signed in to change notification settings - Fork 63
Update buildbot to use XCframework build script. #691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bc5a3ee
Update buildbot to use XCframework build script.
freakboy3742 1ee9d59
Add a symlink for 3.14 compatibility.
freakboy3742 2de77fd
Shorten label for linting.
freakboy3742 4fef73c
Refactor to make the 3.13 and 3.14+ branches more distinct.
freakboy3742 e0423a8
Remove some ruff formatting.
freakboy3742 600e004
Code formatting tweak.
freakboy3742 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1032,6 +1032,7 @@ class _IOSSimulatorBuild(UnixBuild): | |
| build) | ||
| * It invokes `make testios` as a test target | ||
| """ | ||
|
|
||
| buildersuffix = ".iOS-simulator" | ||
| ios_min_version = "" # use the default from the configure file | ||
| factory_tags = ["iOS"] | ||
|
|
@@ -1045,146 +1046,199 @@ def __init__(self, source, **kwargs): | |
| super().__init__(source, **kwargs) | ||
|
|
||
| def setup(self, parallel, branch, test_with_PTY=False, **kwargs): | ||
| out_of_tree_dir = "build_oot" | ||
| oot_dir_path = os.path.join("build", out_of_tree_dir) | ||
| oot_build_path = os.path.join(oot_dir_path, "build") | ||
| oot_host_path = os.path.join(oot_dir_path, "host") | ||
|
|
||
| # Create out of tree directory for "build", the platform we are | ||
| # currently running on | ||
| self.addStep( | ||
| ShellCommand( | ||
| name="mkdir build out-of-tree directory", | ||
| description="Create build out-of-tree directory", | ||
| command=["mkdir", "-p", oot_build_path], | ||
| warnOnFailure=True, | ||
| if branch == "3.13": | ||
| out_of_tree_dir = "build_oot" | ||
| oot_dir_path = os.path.join("build", out_of_tree_dir) | ||
| oot_build_path = os.path.join(oot_dir_path, "build") | ||
| oot_host_path = os.path.join(oot_dir_path, "host") | ||
|
|
||
| # Create out of tree directory for "build", the platform we are | ||
| # currently running on | ||
| self.addStep( | ||
| ShellCommand( | ||
| name="mkdir build out-of-tree directory", | ||
| description="Create build out-of-tree directory", | ||
| command=["mkdir", "-p", oot_build_path], | ||
| warnOnFailure=True, | ||
| ) | ||
| ) | ||
| ) | ||
| # Create directory for "host", the platform we want to compile *for* | ||
| self.addStep( | ||
| ShellCommand( | ||
| name="mkdir host out-of-tree directory", | ||
| description="Create host out-of-tree directory", | ||
| command=["mkdir", "-p", oot_host_path], | ||
| warnOnFailure=True, | ||
| # Create directory for "host", the platform we want to compile *for* | ||
| self.addStep( | ||
| ShellCommand( | ||
| name="mkdir host out-of-tree directory", | ||
| description="Create host out-of-tree directory", | ||
| command=["mkdir", "-p", oot_host_path], | ||
| warnOnFailure=True, | ||
| ) | ||
| ) | ||
| ) | ||
|
|
||
| # First, we build the "build" Python, which we need to cross compile | ||
| # the "host" Python | ||
| self.addStep( | ||
| Configure( | ||
| name="Configure build Python", | ||
| command=["../../configure"], | ||
| workdir=oot_build_path | ||
| # First, we build the "build" Python, which we need to cross compile | ||
| # the "host" Python | ||
| self.addStep( | ||
| Configure( | ||
| name="Configure build Python", | ||
| command=["../../configure"], | ||
| workdir=oot_build_path, | ||
| ) | ||
| ) | ||
| ) | ||
| if parallel: | ||
| compile = ["make", parallel] | ||
| else: | ||
| compile = ["make"] | ||
| if parallel: | ||
| compile = ["make", parallel] | ||
| else: | ||
| compile = ["make"] | ||
|
|
||
| self.addStep( | ||
| Compile( | ||
| name="Compile build Python", | ||
| command=compile, | ||
| workdir=oot_build_path | ||
| self.addStep( | ||
| Compile( | ||
| name="Compile build Python", command=compile, workdir=oot_build_path | ||
| ) | ||
| ) | ||
| ) | ||
|
|
||
| # Ensure the host path is isolated from Homebrew et al, but includes | ||
| # the host helper binaries. Also add the configuration paths for | ||
| # library dependencies. | ||
| support_path = f"/Users/buildbot/support/iphonesimulator.{self.arch}" | ||
| compile_environ = dict(self.compile_environ) | ||
| compile_environ.update({ | ||
| "PATH": os.pathsep.join([ | ||
| # This is intentionally a relative path. Buildbot doesn't expose | ||
| # the absolute working directory where the build is running as | ||
| # something that can be expanded into an environment variable. | ||
| "../../iOS/Resources/bin", | ||
| "/usr/bin", | ||
| "/bin", | ||
| "/usr/sbin", | ||
| "/sbin", | ||
| "/Library/Apple/usr/bin", | ||
| ]), | ||
| "LIBLZMA_CFLAGS": f"-I{support_path}/xz/include", | ||
| "LIBLZMA_LIBS": f"-L{support_path}/xz/lib -llzma", | ||
| "BZIP2_CFLAGS": f"-I{support_path}/bzip2/include", | ||
| "BZIP2_LIBS": f"-L{support_path}/bzip2/lib -lbz2", | ||
| "LIBFFI_CFLAGS": f"-I{support_path}/libffi/include", | ||
| "LIBFFI_LIBS": f"-L{support_path}/libffi/lib -lffi", | ||
| }) | ||
| # Ensure the host path is isolated from Homebrew et al, but includes | ||
| # the host helper binaries. Also add the configuration paths for | ||
| # library dependencies. | ||
| support_path = f"/Users/buildbot/support/iphonesimulator.{self.arch}" | ||
| compile_environ = dict(self.compile_environ) | ||
| compile_environ.update( | ||
| { | ||
| "PATH": os.pathsep.join( | ||
| [ | ||
| # This is intentionally a relative path. Buildbot doesn't expose | ||
| # the absolute working directory where the build is running as | ||
| # something that can be expanded into an environment variable. | ||
| "../../iOS/Resources/bin", | ||
| "/usr/bin", | ||
| "/bin", | ||
| "/usr/sbin", | ||
| "/sbin", | ||
| "/Library/Apple/usr/bin", | ||
| ] | ||
| ), | ||
| "LIBLZMA_CFLAGS": f"-I{support_path}/xz/include", | ||
| "LIBLZMA_LIBS": f"-L{support_path}/xz/lib -llzma", | ||
| "BZIP2_CFLAGS": f"-I{support_path}/bzip2/include", | ||
| "BZIP2_LIBS": f"-L{support_path}/bzip2/lib -lbz2", | ||
| "LIBFFI_CFLAGS": f"-I{support_path}/libffi/include", | ||
| "LIBFFI_LIBS": f"-L{support_path}/libffi/lib -lffi", | ||
| } | ||
| ) | ||
|
|
||
| # Now that we have a "build" architecture Python, we can use that | ||
| # to build a "host" (also known as the target we are cross compiling) | ||
| # Take a copy so that the class-level definition isn't tainted | ||
| configure_cmd = list(self.host_configure_cmd) | ||
| configure_cmd += self.configureFlags | ||
| configure_cmd += self.extra_configure_flags | ||
| configure_cmd += [ | ||
| f"--with-openssl={support_path}/openssl", | ||
| f"--build={self.arch}-apple-darwin", | ||
| f"--host={self.host}", | ||
| "--with-build-python=../build/python.exe", | ||
| "--enable-framework" | ||
| ] | ||
| # Now that we have a "build" architecture Python, we can use that | ||
| # to build a "host" (also known as the target we are cross compiling) | ||
| # Take a copy so that the class-level definition isn't tainted | ||
| configure_cmd = list(self.host_configure_cmd) | ||
| configure_cmd += self.configureFlags | ||
| configure_cmd += self.extra_configure_flags | ||
| configure_cmd += [ | ||
| f"--with-openssl={support_path}/openssl", | ||
| f"--build={self.arch}-apple-darwin", | ||
| f"--host={self.host}", | ||
| "--with-build-python=../build/python.exe", | ||
| "--enable-framework", | ||
| ] | ||
|
|
||
| self.addStep( | ||
| Configure( | ||
| name="Configure host Python", | ||
| command=configure_cmd, | ||
| env=compile_environ, | ||
| workdir=oot_host_path | ||
| self.addStep( | ||
| Configure( | ||
| name="Configure host Python", | ||
| command=configure_cmd, | ||
| env=compile_environ, | ||
| workdir=oot_host_path, | ||
| ) | ||
| ) | ||
| ) | ||
|
|
||
| if parallel: | ||
| compile = ["make", parallel, self.makeTarget] | ||
| install = ["make", parallel, "install"] | ||
| else: | ||
| compile = ["make", self.makeTarget] | ||
| install = ["make", "install"] | ||
| if parallel: | ||
| compile = ["make", parallel, self.makeTarget] | ||
| install = ["make", parallel, "install"] | ||
| else: | ||
| compile = ["make", self.makeTarget] | ||
| install = ["make", "install"] | ||
|
|
||
| self.addStep( | ||
| Compile( | ||
| name="Compile host Python", | ||
| command=compile, | ||
| env=compile_environ, | ||
| workdir=oot_host_path, | ||
| self.addStep( | ||
| Compile( | ||
| name="Compile host Python", | ||
| command=compile, | ||
| env=compile_environ, | ||
| workdir=oot_host_path, | ||
| ) | ||
| ) | ||
| ) | ||
| self.addStep( | ||
| Compile( | ||
| name="Install host Python", | ||
| command=install, | ||
| env=compile_environ, | ||
| workdir=oot_host_path, | ||
| self.addStep( | ||
| Compile( | ||
| name="Install host Python", | ||
| command=install, | ||
| env=compile_environ, | ||
| workdir=oot_host_path, | ||
| ) | ||
| ) | ||
| ) | ||
| self.addStep( | ||
| Test( | ||
| command=["make", "testios"], | ||
| timeout=step_timeout(self.test_timeout), | ||
| usePTY=test_with_PTY, | ||
| env=self.test_environ, | ||
| workdir=oot_host_path, | ||
| self.addStep( | ||
| Test( | ||
| command=["make", "testios"], | ||
| timeout=step_timeout(self.test_timeout), | ||
| usePTY=test_with_PTY, | ||
| env=self.test_environ, | ||
| workdir=oot_host_path, | ||
| ) | ||
| ) | ||
| ) | ||
|
|
||
| self.addStep( | ||
| Clean( | ||
| name="Clean build Python", | ||
| workdir=oot_build_path, | ||
| self.addStep( | ||
| Clean( | ||
| name="Clean build Python", | ||
| workdir=oot_build_path, | ||
| ) | ||
| ) | ||
| ) | ||
| self.addStep( | ||
| Clean( | ||
| name="Clean host Python", | ||
| workdir=oot_host_path, | ||
| self.addStep( | ||
| Clean( | ||
| name="Clean host Python", | ||
| workdir=oot_host_path, | ||
| ) | ||
| ) | ||
| else: | ||
| # Builds of Python 3.14+ can use the XCframework build script. | ||
| # | ||
| # The script moved to the Platforms folder in 3.15; the first command | ||
| # symlinks to the "new" location so that the 3.15+ build instructions | ||
| # will work as-is. This will fail on <= 3.13 PR branches. | ||
| build_environ = { | ||
| "CACHE_DIR": "/Users/buildbot/downloads", | ||
| } | ||
|
|
||
| self.addSteps( | ||
| [ | ||
| ShellCommand( | ||
|
vstinner marked this conversation as resolved.
Outdated
|
||
| name="Set up compatibility symlink (will fail on <= 3.13 branches)", | ||
| command="[ -e Platforms/Apple ] || ln -s ../Apple Platforms/Apple", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The docs say single-string format should work... The |
||
| ), | ||
| Compile( | ||
| name="Configure and compile build Python", | ||
| command=["python3", "Platforms/Apple", "build", "iOS", "build"], | ||
| env=build_environ, | ||
| ), | ||
| Compile( | ||
| name="Configure and compile host Pythons", | ||
| command=["python3", "Platforms/Apple", "build", "iOS", "hosts"], | ||
| env=build_environ, | ||
| ), | ||
| Compile( | ||
| name="Package XCframework", | ||
| command=["python3", "Platforms/Apple", "package", "iOS"], | ||
| env=build_environ, | ||
| ), | ||
| Test( | ||
| name="Run test suite", | ||
| command=[ | ||
| "python3", | ||
| "Platforms/Apple", | ||
| "test", | ||
| "iOS", | ||
| "--slow-ci", | ||
| ], | ||
| env=build_environ, | ||
| timeout=step_timeout(self.test_timeout), | ||
| ), | ||
| Clean( | ||
| name="Clean the builds", | ||
| command=["python3", "Platforms/Apple", "clean", "iOS"], | ||
| env=build_environ, | ||
| ), | ||
| ] | ||
| ) | ||
| ) | ||
|
|
||
|
|
||
| class IOSARM64SimulatorBuild(_IOSSimulatorBuild): | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.