def symlink(name, project, source, ps): a = virtual_target.Action([source], "symlink.ln", ps) return virtual_target.FileTarget(name, source.type(), project, a, exact=True)
def copy_file(project, name, source, ps): if not name: name = source.name() relative = "" new_a = virtual_target.NonScanningAction([source], "common.copy", ps) source_root = ps.get('install-source-root') if source_root: source_root = source_root[0] # Get the real path of the target. We probably need to strip relative # path from the target name at construction. path = os.path.join(source.path(), os.path.dirname(name)) # Make the path absolute. Otherwise, it would be hard to compute the # relative path. The 'source-root' is already absolute, see the # 'adjust-properties' method above. path = os.path.abspath(path) relative = os.path.relpath(path, source_root) name = os.path.join(relative, os.path.basename(name)) return virtual_target.FileTarget(name, source.type(), project, new_a, exact=True)
def construct(self, name, source_targets, ps): i = 0 for t in source_targets: s = self.targets[i] a = virtual_target.Action(self.manager(), [t], "symlink.ln", ps) vt = virtual_target.FileTarget(os.path.basename(s), t.type(), self.project(), a) # Place the symlink in the directory relative to the project # location, instead of placing it in the build directory. if not ps.get('symlink-location') == "project-relative": vt.set_path(os.path.join(self.project().get('location'), os.path.dirname(s))) vt = get_manager().virtual_targets().register(vt) self.virtual_targets.append(vt) i = i + 1 return (property_set.empty(), self.virtual_targets)
def make_unversioned_links(project, name, ps, sources): result = [] filtered = [] nt = os.name == "nt" # Collect the libraries that have the version number in 'filtered'. for s in sources: if nt: m = s.name().endswith(".lib") else: m = re.match("(.*[.]so[.0-9]+)" "(.*[.]dylib)" "(.*[.]a)", s.name()) if m: filtered.append(s) # Create links without version. for s in filtered: a = virtual_target.NonScanningAction(s, "symlink.ln", s.action().properties()) name = s.name() if nt: m = re.match("(.*)-[0-9_]+(.*[.]lib)", name) else: m = re.match("(.*)-[0-9_]+(.*[.]so)[.0-9]*", name) if not m: m = re.match("(.*)-[0-9_]+(.*[.]dylib)", name) if not m: m = re.match("(.*)-[0-9_]+(.*[.]a)", name) if not m: m = re.match("(.*)-[0-9_]+(.*[.]dll[.]a)", name) new_name = m.group(1) + m.group(2) result.append( virtual_target.FileTarget(new_name, s.type(), project, a, exact=True)) return result