MCPcopy Index your code
hub / github.com/astral-sh/python-build-standalone / ContainerContext

Class ContainerContext

pythonbuild/buildenv.py:26–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25
26class ContainerContext:
27 def __init__(self, container):
28 self.container = container
29
30 self.tools_path = "/tools"
31
32 @property
33 def is_isolated(self):
34 return True
35
36 def copy_file(self, source: pathlib.Path, dest_path=None, dest_name=None):
37 dest_name = dest_name or source.name
38 dest_path = dest_path or "/build"
39 copy_file_to_container(source, self.container, dest_path, dest_name)
40
41 def install_toolchain_archive(
42 self, build_dir, package_name, host_platform, version=None
43 ):
44 entry = DOWNLOADS[package_name]
45 basename = "%s-%s-%s.tar" % (
46 package_name,
47 version or entry["version"],
48 host_platform,
49 )
50
51 p = build_dir / basename
52 self.copy_file(p)
53 self.run(["/bin/tar", "-C", "/tools", "-xf", "/build/%s" % p.name])
54
55 def install_artifact_archive(
56 self, build_dir, package_name, target_triple, build_options
57 ):
58 entry = DOWNLOADS[package_name]
59 basename = "%s-%s-%s-%s.tar" % (
60 package_name,
61 entry["version"],
62 target_triple,
63 build_options,
64 )
65
66 p = build_dir / basename
67
68 self.copy_file(p)
69 self.run(["/bin/tar", "-C", "/tools", "-xf", "/build/%s" % p.name])
70
71 def install_toolchain(
72 self,
73 build_dir,
74 host_platform,
75 target_triple: str,
76 binutils=False,
77 musl=False,
78 clang=False,
79 static=False,
80 ):
81 if binutils:
82 self.install_toolchain_archive(build_dir, "binutils", host_platform)
83

Callers 1

build_environmentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected