MCPcopy Create free account
hub / github.com/boostorg/build / SymlinkTarget

Class SymlinkTarget

v2/tools/symlink.py:28–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26feature.feature("symlink-location", ["project-relative", "build-relative"], ["incidental"])
27
28class SymlinkTarget(targets.BasicTarget):
29
30 _count = 0
31
32 def __init__(self, project, targets, sources):
33
34 # Generate a fake name for now. Need unnamed targets eventually.
35 fake_name = "symlink#%s" % SymlinkTarget._count
36 SymlinkTarget._count = SymlinkTarget._count + 1
37
38 b2.build.targets.BasicTarget.__init__(self, fake_name, project, sources)
39
40 # Remember the targets to map the sources onto. Pad or truncate
41 # to fit the sources given.
42 assert len(targets) <= len(sources)
43 self.targets = targets[:] + sources[len(targets):]
44
45 # The virtual targets corresponding to the given targets.
46 self.virtual_targets = []
47
48 def construct(self, name, source_targets, ps):
49 i = 0
50 for t in source_targets:
51 s = self.targets[i]
52 a = virtual_target.Action(self.manager(), [t], "symlink.ln", ps)
53 vt = virtual_target.FileTarget(os.path.basename(s), t.type(), self.project(), a)
54
55 # Place the symlink in the directory relative to the project
56 # location, instead of placing it in the build directory.
57 if not ps.get('symlink-location') == "project-relative":
58 vt.set_path(os.path.join(self.project().get('location'), os.path.dirname(s)))
59
60 vt = get_manager().virtual_targets().register(vt)
61 self.virtual_targets.append(vt)
62 i = i + 1
63
64 return (property_set.empty(), self.virtual_targets)
65
66# Creates a symbolic link from a set of targets to a set of sources.
67# The targets and sources map one to one. The symlinks generated are

Callers 1

symlinkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected