def install(self, path, subdir, *, rename=None, perms=None): """Set the given file to be installed after the build completes. *path* is the path of the file to install, and *target* is a subdirectory of the installation prefix where the file should be installed to. If *rename* is given, it should be a new basename for the file when installed into the target directory.""" path = Path(path) destdir = Path(self.install_destdir) prefix = Path(self.install_prefix) if subdir.startswith('/'): target_root = destdir / subdir[1:] else: if prefix.startswith('/'): prefix = prefix[1:] target_root = destdir / prefix / subdir # Generate the target path. target = target_root / (rename or path.basename()) self.to_install.append(InstallSpec(path.abspath(), target, perms))