4dn-dcic / utils

various util modules shared amongst several projects in our organization
MIT License
4 stars 1 forks source link

License checker extensions #284

Closed netsettler closed 11 months ago

netsettler commented 11 months ago

Some additions to license checkers.

Having done this, though, we removed the scan2-pipeline policy definition because it can now be modularly added elsewhere, in that code. Such a definition can be added in an external module and then invoked interactively by:

run-license-checker scan2-pipeline --policy-dir <dir>

or from code by:

from dcicutils.license_utils import LicenseCheckerRegistry
Scan2PipelineLicenseChecker = LicenseCheckerRegistry.lookup_checker('scan2-pipeline', policy_dir=<policy-dir>)
Scan2PIpelineLicenseChecker.validate()

Note that if the conda checkers do not run, you may be in the wrong directory or Conda may not have set its CONDA_PREFIX environment variable. You can specify the directory by:

from dcicutils.license_utils import LicenseCheckerRegistry, LicenseOptions
Scan2PipelineLicenseChecker = LicenseCheckerRegistry.lookup_checker('scan2-pipeline', policy_dir="<policy-dir>")
with LicenseOptions.selected_options(conda_prefix="<conda-dir>"):
    Scan2PIpelineLicenseChecker.validate()

or you can override the search for Conda's CONDA_PREFIX environment variable by setting the CONDA_LICENSE_CHECKER_PREFIX environment variable, which can be used to override CONDA_PREFIX.

coveralls commented 11 months ago

Pull Request Test Coverage Report for Build 6354777482


Changes Missing Coverage Covered Lines Changed/Added Lines %
dcicutils/license_utils.py 240 317 75.71%
<!-- Total: 254 331 76.74% -->
Totals Coverage Status
Change from base Build 6240767306: -0.1%
Covered Lines: 8478
Relevant Lines: 10917

💛 - Coveralls