| 37 | feature.feature('install-no-version-symlinks', ['on'], ['optional', 'incidental']) |
| 38 | |
| 39 | class InstallTargetClass(targets.BasicTarget): |
| 40 | |
| 41 | def update_location(self, ps): |
| 42 | """If <location> is not set, sets it based on the project data.""" |
| 43 | |
| 44 | loc = ps.get('location') |
| 45 | if not loc: |
| 46 | loc = os.path.join(self.project().get('location'), self.name()) |
| 47 | ps = ps.add_raw(["<location>" + loc]) |
| 48 | |
| 49 | return ps |
| 50 | |
| 51 | def adjust_properties(self, target, build_ps): |
| 52 | a = target.action() |
| 53 | properties = [] |
| 54 | if a: |
| 55 | ps = a.properties() |
| 56 | properties = ps.all() |
| 57 | |
| 58 | # Unless <hardcode-dll-paths>true is in properties, which can happen |
| 59 | # only if the user has explicitly requested it, nuke all <dll-path> |
| 60 | # properties. |
| 61 | |
| 62 | if build_ps.get('hardcode-dll-paths') != ['true']: |
| 63 | properties = [p for p in properties if p.feature().name() != 'dll-path'] |
| 64 | |
| 65 | # If any <dll-path> properties were specified for installing, add |
| 66 | # them. |
| 67 | properties.extend(build_ps.get_properties('dll-path')) |
| 68 | |
| 69 | # Also copy <linkflags> feature from current build set, to be used |
| 70 | # for relinking. |
| 71 | properties.extend(build_ps.get_properties('linkflags')) |
| 72 | |
| 73 | # Remove the <tag> feature on original targets. |
| 74 | # And <location>. If stage target has another stage target in |
| 75 | # sources, then we shall get virtual targets with the <location> |
| 76 | # property set. |
| 77 | properties = [p for p in properties |
| 78 | if not p.feature().name() in ['tag', 'location']] |
| 79 | |
| 80 | properties.extend(build_ps.get_properties('dependency')) |
| 81 | |
| 82 | properties.extend(build_ps.get_properties('location')) |
| 83 | |
| 84 | |
| 85 | properties.extend(build_ps.get_properties('install-no-version-symlinks')) |
| 86 | |
| 87 | d = build_ps.get_properties('install-source-root') |
| 88 | |
| 89 | # Make the path absolute: we shall use it to compute relative paths and |
| 90 | # making the path absolute will help. |
| 91 | if d: |
| 92 | p = d[0] |
| 93 | properties.append(property.Property(p.feature(), os.path.abspath(p.value()))) |
| 94 | |
| 95 | return property_set.create(properties) |
| 96 | |