GithubHelp home page GithubHelp logo

petamas / conan-io-hooks Goto Github PK

View Code? Open in Web Editor NEW

This project forked from conan-io/hooks

0.0 0.0 0.0 844 KB

Official Conan client hooks

License: MIT License

Shell 0.67% Python 99.16% Batchfile 0.17%

conan-io-hooks's Introduction

Conan Hooks

logo

Build Status

Repository to develop experimental Conan hooks for Conan >= 1.8.

Hook setup

Place your hook Python files under ~/.conan/hooks. The name of the hook would be the same one as the file name.

*~/.conan/hooks/conan-center.py

Only copying hook files will not activate them.

Conan config as installer

To install all hooks from Conan repository in Github:

$ conan config install https://github.com/conan-io/hooks.git

If you are using Conan >=1.14 you can specify the source and destination folder to avoid copying undesired files to your local cache:

$ conan config install https://github.com/conan-io/hooks.git -sf hooks -tf hooks

Conan config install does not activate any hook.

Hook activation

You can activate any hook with:

$ conan config set hooks.conan-center

If you handle multiple dependencies in your project is better to add a conan.conf:

    [hooks]
    attribute_checker
    conan-center_reviewer

Hooks

These are the hooks currently available in this repository

This hook does checks for the inclusion guidelines of third-party libraries in Conan Center.

It is mostly intended for users who want to contribute packages to Conan Center. With this hook they will test some of the requirements in the guidelines, as this hook will check for recipe metadata, binary matching... during the conan create step and will output the result of each check as OK, WARNING or ERROR:

[HOOK - conan-center_reviewer.py] pre_export(): [RECIPE METADATA] OK
[HOOK - conan-center_reviewer.py] pre_export(): [HEADER ONLY] OK
[HOOK - conan-center_reviewer.py] pre_export(): [NO COPY SOURCE] OK
[HOOK - conan-center_reviewer.py] pre_export(): [FPIC OPTION] OK
[HOOK - conan-center_reviewer.py] pre_export(): [FPIC MANAGEMENT] 'fPIC' option not found
[HOOK - conan-center_reviewer.py] pre_export(): [VERSION RANGES] OK
[HOOK - conan-center_reviewer.py] post_package(): ERROR: [PACKAGE LICENSE] No package licenses found in: ~/
.conan/data/name/version/jgsogo/test/package/3475bd55b91ae904ac96fde0f106a136ab951a5e. Please
 package the library license to a 'licenses' folder
[HOOK - conan-center_reviewer.py] post_package(): [DEFAULT PACKAGE LAYOUT] OK
[HOOK - conan-center_reviewer.py] post_package(): [MATCHING CONFIGURATION] OK
[HOOK - conan-center_reviewer.py] post_package(): [SHARED ARTIFACTS] OK

If you want the hook to fail the execution, if an error is reported, you can adjust the environment variable CONAN_HOOK_ERROR_LEVEL:

  • CONAN_HOOK_ERROR_LEVEL=40 it will raise if any error happen.
  • CONAN_HOOK_ERROR_LEVEL=30 it will raise if any error or warning happen.

This hook checks that some important attributes are present in the ConanFile: url, license and description, and will output a warning for the missing ones.

This Conan hook validates produced binary artifacts of the given package.

Binaries stored in the package folder are checked for compatibility with package settings and options.

Currently, the following checks are performed:

  • Binary format (Mach-O, ELF or PE)
  • Architecture
  • No shared libraries are produced for shared=False
  • Visual Studio runtime library in use

The hook uses LIEF library in order to perform its checks.

The hook is automatically called when package command is executed.

This Conan hook reads your recipe and updates its GitHub repository properties using the attributes.

The following attributes are updated:

  • homepage

  • description

  • topics

It's necessary to pass GitHub token by environment variable: GITHUB_TOKEN.

This pre_export() hook checks ConanFile's members for potential typos, for example:

from conans import ConanFile

class ConanRecipe(ConanFile):
    name = "name"
    version = "version"

    export_sources = "OH_NO"

Will produce the next warning:

pre_export(): WARN: The 'export_sources' member looks like a typo. Similar to:
pre_export(): WARN:     exports_sources

This Conan hook validates that conanfile's license attribute specifies valid license identifier(s) from the SPDX license list.

The hook uses spdx_lookup python module in order to perform its checks.

Use pip install spdx_lookup in order to install required dependency.

The hook is automatically called when export command is executed.

This hook runs Pylint over the recipes before exporting them (it runs in the pre_export hook), it can be really useful to check for typos, code flaws or company standards.

There several environment variables you can use to configure it:

  • CONAN_PYLINTRC: path to a configuration file to fully customize Pylint behavior.
  • CONAN_PYLINT_WERR: if set, linting errors will trigger a ConanException.
  • CONAN_PYLINT_RECIPE_PLUGINS: list of modules (comma separated list) to load. They are used to register additional checker or dynamic fields before running the linter. By default it points to the conans.pylint_plugin module distributed together with Conan, this file contains the declaration of some extra fields that are valid in the ConanFile class.

This hook requires additional dependencies to work: pip install pylint astroid.

Separate KB-H047 from Conan Center, which is no longer required due Python 2.7 deprecation.

Validates if conanfile.py and test_package/conanfile.py contain a non-ascii present, when there is a character, it logs an error.

This hook runs yamllint over the yaml files in a recipe before exporting them (it runs in the pre_export hook), it can be really useful to check for typos.

This hook requires additional dependencies to work: pip install yamllint.

Same as KB-H031, but for conan 2.0. Reduces conandata.yml files, keeping only entry for the current package version. It only helps to avoid generation of extra recipe revisions in case of adding new versions.

License

MIT License

conan-io-hooks's People

Contributors

uilianries avatar danimtb avatar jgsogo avatar lasote avatar sse4 avatar ericlemanissier avatar madebr avatar theirix avatar minimonium avatar spaceim avatar czoido avatar croydon avatar sparik avatar dmn-star avatar a4z avatar boussaffawalid avatar pro avatar serpent7776 avatar ohanar avatar gokhanettin avatar garethsb avatar estebandugueperoux2 avatar cguldner avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.