aboutcode-org / typecode

7 stars 9 forks source link

Implement new library loading approach #20

Closed pombredanne closed 3 years ago

pombredanne commented 3 years ago

We now load the libmagic native library and its database from paths found in:

  1. environment variables,
  2. OR a location provider plugin,
  3. OR the system PATH,
  4. OR we fail with an informative error message.

Based on original code contributed by @priv-kweihmann to scancode-plugins in https://github.com/nexB/scancode-plugins/pull/9 and moved here and adapted for use in the core code rather than in a plugin.

This also includes the merge of @tardyp #17 to search for common locations as a failover

Signed-off-by: Philippe Ombredanne pombredanne@nexb.com

Signed-off-by: Philippe Ombredanne pombredanne@nexb.com

pombredanne commented 3 years ago

@tardyp I merged 17 in this branch which also carries over in a single place the code originally contributed by @priv-kweihmann for the typecode_libmagic_system_provided plugins https://github.com/nexB/scancode-plugins/pull/9

Getting both of your reviews would be great before I merge

pombredanne commented 3 years ago

@tardyp you wrote:

I am having hard time reviewing this 272 files PR. Franckly I am not a huge fan of vendoring for opensource projects, although I do understand the need to limit dependency variablility for support reason

I agree yet the Pygments vendoring here is a must here as we have dependencies on specific versions and vendoring is the sane approach to avoid conflicts (that popped up often in the past) when this fairly common Pygments library is installed otherwise.

pombredanne commented 3 years ago

@tardyp note also that we should be able to support Apple ARM chips as soon as I can find some CI supporting it.

pombredanne commented 3 years ago

This looks decent now. Merging and releasing!