Skip to content

Commit

Permalink
Copy licence files more selectively
Browse files Browse the repository at this point in the history
  • Loading branch information
kyllingstad committed Mar 6, 2024
1 parent eca89fe commit cbd1397
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,21 @@ 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 _import_license(self, dependency, licenses_dir):
src_licenses_dir = os.path.join(dependency.package_folder, "licenses")
tgt_licenses_dir = os.path.join(licenses_dir, dependency.ref.name)
if os.path.isdir(src_licenses_dir):
# Copy the full contents of '<package_dir>/licenses/' if it exists,
# which it does for virtually all conan-center packages.
copy(self, "*", src_licenses_dir, tgt_licenses_dir)
else:
# Copy everything that looks like it might contain license and
# copyright information.
copy(self, "*license*", dependency.package_folder, tgt_licenses_dir, keep_path=False)
copy(self, "*copying*", dependency.package_folder, tgt_licenses_dir, keep_path=False)
copy(self, "*notice*", dependency.package_folder, tgt_licenses_dir, keep_path=False)
copy(self, "*authors*", dependency.package_folder, tgt_licenses_dir, keep_path=False)
copy(self, "*copyright*", dependency.package_folder, tgt_licenses_dir, keep_path=False)

def _update_rpath(self, files, new_rpath):
if files and self.settings.os == "Linux":
Expand Down

0 comments on commit cbd1397

Please sign in to comment.