macaron.build_spec_generator.dockerfile package
Submodules
macaron.build_spec_generator.dockerfile.dockerfile_output module
This module acts as the dispatcher to execute the right dockerfile generation logic for a buildspec’s ecosystem.
- macaron.build_spec_generator.dockerfile.dockerfile_output.gen_dockerfile(buildspec)
Dispatches the gen_dockerfile corresponding to the build’s ecosystem.
- Parameters:
buildspec (BaseBuildSpecDict) – The base build spec generated for the artifact.
- Returns:
Contents of the dockerfile for this artifact’s rebuild.
- Return type:
- Raises:
GenerateBuildSpecError – Raised if dockerfile cannot be generated.
macaron.build_spec_generator.dockerfile.pypi_dockerfile_output module
This module implements the logic to generate a dockerfile from a Python buildspec.
- macaron.build_spec_generator.dockerfile.pypi_dockerfile_output.gen_dockerfile(buildspec)
Translate the build specification into a dockerfile built on OL9.
- Parameters:
buildspec (BaseBuildSpecDict) – The base build spec generated for the artifact.
- Returns:
Contents of the dockerfile for this artifact’s rebuild.
- Return type:
- Raises:
GenerateBuildSpecError – Raised if dockerfile cannot be generated.
- macaron.build_spec_generator.dockerfile.pypi_dockerfile_output.openssl_install_commands(version)
Appropriate openssl install commands for a given CPython version.
- Parameters:
version (Version) – CPython version we are trying to build
- Returns:
Install commands for the corresponding openssl version
- Return type:
- macaron.build_spec_generator.dockerfile.pypi_dockerfile_output.pick_specific_version(inferred_constraints)
Find the latest python interpreter version satisfying inferred constraints.
- Parameters:
inferred_constraints (list[str]) – List of inferred Python version constraints
- Returns:
String in format major.minor.patch for the latest valid Python interpreter version, or None if no such version can be found.
- Return type:
str | None
Examples
>>> pick_specific_version([">=3.0"]) '3.4.10' >>> pick_specific_version([">=3.8"]) '3.8.20' >>> pick_specific_version([">=3.0", "!=3.4", "!=3.3", "!=3.5"]) '3.6.15' >>> pick_specific_version(["<=3.12"]) '3.4.10' >>> pick_specific_version(["<=3.12", "==3.6"]) '3.6.15'
- macaron.build_spec_generator.dockerfile.pypi_dockerfile_output.infer_interpreter_version(specifier)
Infer interpreter version from Python-tag.
Note: This function is called on version specifiers that we cannot trivially parse. In the case that it is a Python-tag, which is obtained from the wheel name, we attempt to infer the corresponding interpreter version.
- Parameters:
specifier (str) – specifier string that could not be trivially parsed.
- Returns:
The interpreter version inferred from the specifier, or None if we cannot parse the specifier as a Python-tag.
- Return type:
str | None
Examples
>>> infer_interpreter_version("py3") '3' >>> infer_interpreter_version("cp314") '3.14' >>> infer_interpreter_version("pypy311") '3.11' >>> infer_interpreter_version("malformed123")
- macaron.build_spec_generator.dockerfile.pypi_dockerfile_output.get_latest_cpython_patch(major, minor)
Given major and minor interpreter version, return latest CPython patched version.
- macaron.build_spec_generator.dockerfile.pypi_dockerfile_output.build_backend_commands(buildspec)
Generate the installation commands for each inferred build backend.
- Parameters:
buildspec (BaseBuildSpecDict) – The base build spec generated for the artifact.
- Returns:
List of the installation commands.
- Return type: