Skip to content

Commit

Permalink
Include dependency licences in distribution bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
kyllingstad committed Mar 4, 2024
1 parent 71b7bf3 commit eca89fe
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ def generate(self):
"boost_thread*"],
"thrift": ["thrift", "thriftd"],
}
for req, dep in self.dependencies.items():
self._import_dynamic_libs(dep, dldir, dependency_libs.get(req.ref.name, ["*"]))
licensedir = os.path.join(self.build_folder, "dist", "doc", "licenses")
for dep in self.dependencies.host.values():
self._import_dynamic_libs(dep, dldir, dependency_libs.get(dep.ref.name, ["*"]))
self._import_license(dep, licensedir)
if self.dependencies["libcosim"].options.proxyfmu:
self._import_executables(self.dependencies["proxyfmu"], bindir, ["*"])

Expand Down Expand Up @@ -74,6 +76,20 @@ def _import_executables(self, dependency, target_dir, patterns=["*"]):
files = copy(self, patternx, bindir, target_dir, keep_path=False)
self._update_rpath(files, "$ORIGIN/../lib")

def _import_license(self, dependency, target_dir):
dep_license_dir = os.path.join(target_dir, dependency.ref.name)
copy(self, "licenses/*", dependency.package_folder, dep_license_dir, keep_path=False)
copy(self, "license*", dependency.package_folder, dep_license_dir, keep_path=False)
copy(self, "*/license*", dependency.package_folder, dep_license_dir, keep_path=False)
copy(self, "copying*", dependency.package_folder, dep_license_dir, keep_path=False)
copy(self, "*/copying*", dependency.package_folder, dep_license_dir, keep_path=False)
copy(self, "notice*", dependency.package_folder, dep_license_dir, keep_path=False)
copy(self, "*/notice*", dependency.package_folder, dep_license_dir, keep_path=False)
copy(self, "authors*", dependency.package_folder, dep_license_dir, keep_path=False)
copy(self, "*/authors*", dependency.package_folder, dep_license_dir, keep_path=False)
copy(self, "copyright*", dependency.package_folder, dep_license_dir, keep_path=False)
copy(self, "*/copyright*", dependency.package_folder, dep_license_dir, keep_path=False)

def _update_rpath(self, files, new_rpath):
if files and self.settings.os == "Linux":
with VirtualBuildEnv(self).environment().vars(self).apply():
Expand Down

0 comments on commit eca89fe

Please sign in to comment.