license_finder 6.10.0 → 6.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/CONTRIBUTING.md +3 -2
- data/Dockerfile +15 -3
- data/README.md +11 -10
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/license_finder/cli/base.rb +3 -1
- data/lib/license_finder/cli/main.rb +3 -0
- data/lib/license_finder/configuration.rb +8 -0
- data/lib/license_finder/core.rb +3 -1
- data/lib/license_finder/package.rb +1 -0
- data/lib/license_finder/package_manager.rb +4 -3
- data/lib/license_finder/package_managers/composer.rb +7 -3
- data/lib/license_finder/package_managers/conda.rb +131 -0
- data/lib/license_finder/packages/conda_package.rb +74 -0
- data/lib/license_finder/scanner.rb +2 -1
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 73b9ecbd4718f26feaf025ecfe39dc87d3a68538fb5a63118cc7970940930fa2
|
|
4
|
+
data.tar.gz: 4b7544aef7f9c5a312c2bc58fb277217109f4cc6095a65d252e738a3705a54f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b51e18d0be7d5b25e62b52fbd4a046ab0a7cdba9ea865210172a4026b63e4c2b566446de40bccf45b331580f9de25ed05f620e1b2ccbb6c182162347f0f8b653
|
|
7
|
+
data.tar.gz: 58ab33ffa3395bf495fd5b392a89a2fa40d6f1c36228241df10b28534357f76d6cc6ab663a2e0c859684c75a69d4464f6dcd4dc5d8f69e30e84add4589506d0f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# [6.10.1] / 2021-01-08
|
|
2
|
+
|
|
1
3
|
# [6.10.0] / 2020-11-27
|
|
2
4
|
|
|
3
5
|
# [6.9.0] / 2020-10-05
|
|
@@ -924,3 +926,4 @@ Bugfixes:
|
|
|
924
926
|
[6.8.2]: https://github.com/pivotal/LicenseFinder/compare/v6.8.1...v6.8.2
|
|
925
927
|
[6.9.0]: https://github.com/pivotal/LicenseFinder/compare/v6.8.2...v6.9.0
|
|
926
928
|
[6.10.0]: https://github.com/pivotal/LicenseFinder/compare/v6.9.0...v6.10.0
|
|
929
|
+
[6.10.1]: https://github.com/pivotal/LicenseFinder/compare/v6.10.0...v6.10.1
|
data/CONTRIBUTING.md
CHANGED
|
@@ -24,8 +24,8 @@ will use the gem version installed inside the docker image.
|
|
|
24
24
|
|
|
25
25
|
## Useful Tips
|
|
26
26
|
|
|
27
|
-
To build the docker image simply call `docker build .` or explicitly pass the `Dockerfile`. Prebuilt versions of the
|
|
28
|
-
dockerfile can also be found on [Dockerhub](https://hub.docker.com/r/licensefinder/license_finder/tags/).
|
|
27
|
+
To build the docker image simply call `docker build .` or explicitly pass the `Dockerfile`. Prebuilt versions of the
|
|
28
|
+
dockerfile can also be found on [Dockerhub](https://hub.docker.com/r/licensefinder/license_finder/tags/).
|
|
29
29
|
|
|
30
30
|
To launch the docker image and interact with it via bash:
|
|
31
31
|
```
|
|
@@ -91,6 +91,7 @@ To successfully run the test suite, you will need the following installed:
|
|
|
91
91
|
- Conan
|
|
92
92
|
- NuGet
|
|
93
93
|
- dotnet
|
|
94
|
+
- Conda (requires python)
|
|
94
95
|
|
|
95
96
|
The [LicenseFinder docker image](https://hub.docker.com/r/licensefinder/license_finder/) already contains these dependencies.
|
|
96
97
|
|
data/Dockerfile
CHANGED
|
@@ -2,7 +2,7 @@ FROM ubuntu:xenial
|
|
|
2
2
|
|
|
3
3
|
# Versioning
|
|
4
4
|
ENV PIP_INSTALL_VERSION 19.0.2
|
|
5
|
-
ENV PIP3_INSTALL_VERSION
|
|
5
|
+
ENV PIP3_INSTALL_VERSION 20.0.2
|
|
6
6
|
ENV GO_LANG_VERSION 1.14.3
|
|
7
7
|
ENV MAVEN_VERSION 3.6.0
|
|
8
8
|
ENV SBT_VERSION 1.3.3
|
|
@@ -55,8 +55,8 @@ RUN curl -o rebar3 https://s3.amazonaws.com/rebar3/rebar3 && \
|
|
|
55
55
|
|
|
56
56
|
# install and update python and python-pip
|
|
57
57
|
RUN apt-get install -y python python-pip python3-pip && \
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
python3 -m pip install pip==$PIP3_INSTALL_VERSION --upgrade && \
|
|
59
|
+
python -m pip install pip==$PIP_INSTALL_VERSION --upgrade --force
|
|
60
60
|
|
|
61
61
|
# install maven
|
|
62
62
|
RUN curl -O https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz && \
|
|
@@ -167,6 +167,18 @@ RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 4F4EA0AAE5
|
|
|
167
167
|
php -r "unlink('composer-setup.php');" &&\
|
|
168
168
|
mv composer.phar /usr/bin/composer
|
|
169
169
|
|
|
170
|
+
# install miniconda
|
|
171
|
+
# See https://docs.conda.io/en/latest/miniconda_hashes.html
|
|
172
|
+
# for latest versions and SHAs.
|
|
173
|
+
WORKDIR /tmp
|
|
174
|
+
RUN \
|
|
175
|
+
conda_installer=Miniconda3-py38_4.9.2-Linux-x86_64.sh &&\
|
|
176
|
+
ref='1314b90489f154602fd794accfc90446111514a5a72fe1f71ab83e07de9504a7' &&\
|
|
177
|
+
wget -q https://repo.anaconda.com/miniconda/${conda_installer} &&\
|
|
178
|
+
sha=`openssl sha256 "${conda_installer}" | cut -d' ' -f2` &&\
|
|
179
|
+
([ "$sha" = "${ref}" ] || (echo "Verification failed: ${sha} != ${ref}"; false)) &&\
|
|
180
|
+
(echo; echo "yes") | sh "${conda_installer}"
|
|
181
|
+
|
|
170
182
|
# install license_finder
|
|
171
183
|
COPY . /LicenseFinder
|
|
172
184
|
RUN bash -lc "cd /LicenseFinder && bundle config set no-cache 'true' && bundle install -j4 && rake install"
|
data/README.md
CHANGED
|
@@ -54,6 +54,7 @@ and give you an actionable exception report.
|
|
|
54
54
|
* Rust (via `cargo`)
|
|
55
55
|
* Go Modules (via `go mod`)
|
|
56
56
|
* PHP (via `composer`)
|
|
57
|
+
* Python (via Conda [Conda 4.8.3, Python 3.7, Bash; requires an `environment.yml` or `environment.yaml`])
|
|
57
58
|
|
|
58
59
|
## Installation
|
|
59
60
|
|
|
@@ -121,9 +122,9 @@ be useful when you need to track down an unexpected package or
|
|
|
121
122
|
license.
|
|
122
123
|
|
|
123
124
|
If you do not want to manually run an individual package manager's prepare
|
|
124
|
-
command (ex: `bundle install`, `npm install`, etc) to ensure your project
|
|
125
|
+
command (ex: `bundle install`, `npm install`, etc) to ensure your project
|
|
125
126
|
is fully prepared to be scanned, use the `--prepare` or `-p` option which will run
|
|
126
|
-
each active package manager's prepare command for you. If you would like to continue
|
|
127
|
+
each active package manager's prepare command for you. If you would like to continue
|
|
127
128
|
running `license_finder` even if there is an issue with a prepare step, use the
|
|
128
129
|
`--prepare-no-fail` option which prepares but carries on despite any potential failures.
|
|
129
130
|
|
|
@@ -156,7 +157,7 @@ You can better understand the way this script works by looking at its source, bu
|
|
|
156
157
|
reference it will mount your current directory at the path `/scan` and run any commands
|
|
157
158
|
passed to it from that directory.
|
|
158
159
|
|
|
159
|
-
Note that the docker image will run the gem which is installed within it.
|
|
160
|
+
Note that the docker image will run the gem which is installed within it.
|
|
160
161
|
So the docker image tagged `4.0.2` will run *License Finder Version 4.0.2*
|
|
161
162
|
|
|
162
163
|
See the [contributing guide](https://github.com/pivotal/LicenseFinder/blob/master/CONTRIBUTING.md) for information on development.
|
|
@@ -310,7 +311,7 @@ be approved. The project name at the top of the report can be set with
|
|
|
310
311
|
`license_finder project_name add`.
|
|
311
312
|
|
|
312
313
|
### Note:
|
|
313
|
-
When using the yarn package manager, when a node_module's package.json doesn't
|
|
314
|
+
When using the yarn package manager, when a node_module's package.json doesn't
|
|
314
315
|
explicitly declare a license, yarn indicates that it has inferred the license based
|
|
315
316
|
on some keywords in other files by appending an asterisk to the license name. If you
|
|
316
317
|
see a * at the end of the license name, this is intended.
|
|
@@ -423,11 +424,11 @@ set `--mix_deps_dir` to fetch Mix dependencies from a custom directory.
|
|
|
423
424
|
### Narrow down Package Manager
|
|
424
425
|
|
|
425
426
|
By default, license_finder will check for all supported package managers,
|
|
426
|
-
but you can narrow it down to use only those you pass to `--enabled-package-
|
|
427
|
+
but you can narrow it down to use only those you pass to `--enabled-package-managers`.
|
|
427
428
|
For example,
|
|
428
429
|
|
|
429
430
|
```
|
|
430
|
-
$ license_finder --enabled-package-
|
|
431
|
+
$ license_finder --enabled-package-managers bundler npm
|
|
431
432
|
```
|
|
432
433
|
|
|
433
434
|
### Saving Configuration
|
|
@@ -475,9 +476,9 @@ downloadLicenses {
|
|
|
475
476
|
### Conan Projects
|
|
476
477
|
|
|
477
478
|
`license_finder` supports Conan. You need to have the following lines in your conanfile.txt for `license_finder` to retrieve dependencies' licenses.
|
|
478
|
-
Ensure that `conan install` does not generate an error.
|
|
479
|
+
Ensure that `conan install` does not generate an error.
|
|
479
480
|
|
|
480
|
-
```
|
|
481
|
+
```
|
|
481
482
|
[imports]
|
|
482
483
|
., license* -> ./licenses @ folder=True, ignore_case=True
|
|
483
484
|
```
|
|
@@ -531,9 +532,9 @@ And save a `LICENSE` file which contains your license text in your repo.
|
|
|
531
532
|
|
|
532
533
|
* Bundler
|
|
533
534
|
* When using `--project-path`, Bundler cannot find the Gemfile.
|
|
534
|
-
|
|
535
|
+
|
|
535
536
|
* Yarn
|
|
536
|
-
* A module that is incompatible with the platform on which
|
|
537
|
+
* A module that is incompatible with the platform on which
|
|
537
538
|
license_finder is run will always be reported to have a license type
|
|
538
539
|
of "unknown". ([#456](https://github.com/pivotal/LicenseFinder/issues/456))
|
|
539
540
|
|
data/Rakefile
CHANGED
|
@@ -54,7 +54,7 @@ task :update_pipeline, [:slack_url, :slack_channel] do |_, args|
|
|
|
54
54
|
puts 'Warning: You should provide slack channel and url to receive slack notifications on build failures'
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
ruby_versions = %w[2.7.1 2.6.5 2.5.7 2.4.9 2.3.8
|
|
57
|
+
ruby_versions = %w[2.7.1 2.6.5 2.5.7 2.4.9 2.3.8]
|
|
58
58
|
|
|
59
59
|
params = []
|
|
60
60
|
params << "ruby_versions=#{ruby_versions.join(',')}"
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.10.
|
|
1
|
+
6.10.1
|
|
@@ -38,6 +38,9 @@ module LicenseFinder
|
|
|
38
38
|
class_option :mix_command, desc: "Command to use when fetching packages through Mix. Only meaningful if used with a Mix project (i.e., Elixir or Erlang). Defaults to 'mix'."
|
|
39
39
|
class_option :mix_deps_dir, desc: "Path to Mix dependencies directory. Only meaningful if used with a Mix project (i.e., Elixir or Erlang). Defaults to 'deps'."
|
|
40
40
|
class_option :sbt_include_groups, desc: 'Whether dependency name should include group id. Only meaningful if used with a Scala/sbt project. Defaults to false.'
|
|
41
|
+
class_option :conda_bash_setup_script, desc: "Path to conda.sh script. Only meaningful if used with a Conda project. Defaults to '~/miniconda3/etc/profile.d/conda.sh'."
|
|
42
|
+
class_option :composer_check_require_only,
|
|
43
|
+
desc: "Whether to only check for licenses from dependencies on the 'require' section. Only meaningful if used with a Composer project. Defaults to false."
|
|
41
44
|
|
|
42
45
|
# Method options which are shared between report and action_item
|
|
43
46
|
def self.format_option
|
|
@@ -97,6 +97,10 @@ module LicenseFinder
|
|
|
97
97
|
get(:pip_requirements_path)
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
+
def conda_bash_setup_script
|
|
101
|
+
get(:conda_bash_setup_script)
|
|
102
|
+
end
|
|
103
|
+
|
|
100
104
|
def python_version
|
|
101
105
|
get(:python_version)
|
|
102
106
|
end
|
|
@@ -141,6 +145,10 @@ module LicenseFinder
|
|
|
141
145
|
get(:sbt_include_groups)
|
|
142
146
|
end
|
|
143
147
|
|
|
148
|
+
def composer_check_require_only
|
|
149
|
+
get(:composer_check_require_only)
|
|
150
|
+
end
|
|
151
|
+
|
|
144
152
|
attr_writer :strict_matching
|
|
145
153
|
|
|
146
154
|
attr_reader :strict_matching
|
data/lib/license_finder/core.rb
CHANGED
|
@@ -108,7 +108,9 @@ module LicenseFinder
|
|
|
108
108
|
mix_deps_dir: config.mix_deps_dir,
|
|
109
109
|
prepare: config.prepare,
|
|
110
110
|
prepare_no_fail: config.prepare_no_fail,
|
|
111
|
-
sbt_include_groups: config.sbt_include_groups
|
|
111
|
+
sbt_include_groups: config.sbt_include_groups,
|
|
112
|
+
conda_bash_setup_script: config.conda_bash_setup_script,
|
|
113
|
+
composer_check_require_only: config.composer_check_require_only
|
|
112
114
|
}
|
|
113
115
|
end
|
|
114
116
|
end
|
|
@@ -129,10 +129,10 @@ module LicenseFinder
|
|
|
129
129
|
def log_errors_with_cmd(prep_cmd, stderr)
|
|
130
130
|
logger.info(prep_cmd, 'did not succeed.', color: :red)
|
|
131
131
|
logger.info(prep_cmd, stderr, color: :red)
|
|
132
|
-
log_to_file stderr
|
|
132
|
+
log_to_file(prep_cmd, stderr)
|
|
133
133
|
end
|
|
134
134
|
|
|
135
|
-
def log_to_file(contents)
|
|
135
|
+
def log_to_file(prep_cmd, contents)
|
|
136
136
|
FileUtils.mkdir_p @log_directory
|
|
137
137
|
|
|
138
138
|
# replace whitespace with underscores and remove slashes
|
|
@@ -140,7 +140,7 @@ module LicenseFinder
|
|
|
140
140
|
log_file = File.join(@log_directory, "prepare_#{log_file_name || 'errors'}.log")
|
|
141
141
|
|
|
142
142
|
File.open(log_file, 'w') do |f|
|
|
143
|
-
f.write("Prepare command \"#{
|
|
143
|
+
f.write("Prepare command \"#{prep_cmd}\" failed with:\n")
|
|
144
144
|
f.write("#{contents}\n\n")
|
|
145
145
|
end
|
|
146
146
|
end
|
|
@@ -175,5 +175,6 @@ require 'license_finder/package_managers/conan'
|
|
|
175
175
|
require 'license_finder/package_managers/sbt'
|
|
176
176
|
require 'license_finder/package_managers/cargo'
|
|
177
177
|
require 'license_finder/package_managers/composer'
|
|
178
|
+
require 'license_finder/package_managers/conda'
|
|
178
179
|
|
|
179
180
|
require 'license_finder/package'
|
|
@@ -4,7 +4,10 @@ require 'json'
|
|
|
4
4
|
|
|
5
5
|
module LicenseFinder
|
|
6
6
|
class Composer < PackageManager
|
|
7
|
-
|
|
7
|
+
def initialize(options = {})
|
|
8
|
+
super
|
|
9
|
+
@check_require_only = !!options[:composer_check_require_only]
|
|
10
|
+
end
|
|
8
11
|
|
|
9
12
|
def possible_package_paths
|
|
10
13
|
[project_path.join('composer.lock'), project_path.join('composer.json')]
|
|
@@ -50,8 +53,9 @@ module LicenseFinder
|
|
|
50
53
|
end
|
|
51
54
|
|
|
52
55
|
def composer_json
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
command = "composer licenses --format=json#{@check_require_only ? ' --no-dev' : ''}"
|
|
57
|
+
stdout, stderr, status = Dir.chdir(project_path) { Cmd.run(command) }
|
|
58
|
+
raise "Command '#{command}' failed to execute: #{stderr}" unless status.success?
|
|
55
59
|
|
|
56
60
|
JSON(stdout)
|
|
57
61
|
end
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
5
|
+
module LicenseFinder
|
|
6
|
+
class Conda < PackageManager
|
|
7
|
+
attr_reader :conda_bash_setup_script
|
|
8
|
+
|
|
9
|
+
def initialize(options = {})
|
|
10
|
+
@conda_bash_setup_script = options[:conda_bash_setup_script] || Pathname("#{ENV['HOME']}/miniconda3/etc/profile.d/conda.sh")
|
|
11
|
+
super
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# This command is *not* directly executable. See .conda() below.
|
|
15
|
+
def prepare_command
|
|
16
|
+
"conda env create -f #{detected_package_path}"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def prepare
|
|
20
|
+
return if environment_exists?
|
|
21
|
+
|
|
22
|
+
prep_cmd = prepare_command
|
|
23
|
+
_stdout, stderr, status = Dir.chdir(project_path) { conda(prep_cmd) }
|
|
24
|
+
return if status.success?
|
|
25
|
+
|
|
26
|
+
log_errors stderr
|
|
27
|
+
raise "Prepare command '#{prep_cmd}' failed" unless @prepare_no_fail
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def current_packages
|
|
31
|
+
conda_list.map do |entry|
|
|
32
|
+
case entry['channel']
|
|
33
|
+
when 'pypi'
|
|
34
|
+
# PyPI is much faster than `conda search`, use it when we can.
|
|
35
|
+
PipPackage.new(entry['name'], entry['version'], PyPI.definition(entry['name'], entry['version']))
|
|
36
|
+
else
|
|
37
|
+
CondaPackage.new(conda_search_info(entry))
|
|
38
|
+
end
|
|
39
|
+
end.compact
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def possible_package_paths
|
|
43
|
+
[project_path.join('environment.yaml'), project_path.join('environment.yml')]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
def environment_exists?
|
|
49
|
+
environments.grep(environment_name).any?
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def environments
|
|
53
|
+
command = 'conda env list'
|
|
54
|
+
stdout, stderr, status = conda command
|
|
55
|
+
|
|
56
|
+
environments = []
|
|
57
|
+
if status.success?
|
|
58
|
+
environments = stdout.split("\n").grep_v(/^#/).map { |line| line.split.first }
|
|
59
|
+
else
|
|
60
|
+
log_errors_with_cmd command, stderr
|
|
61
|
+
end
|
|
62
|
+
environments
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def environment_file
|
|
66
|
+
detected_package_path
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def environment_name
|
|
70
|
+
@environment_name ||= YAML.load_file(environment_file).fetch('name')
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def conda(command)
|
|
74
|
+
Open3.capture3('bash', '-c', "source #{conda_bash_setup_script} && #{command}")
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def activated_conda(command)
|
|
78
|
+
Open3.capture3('bash', '-c', "source #{conda_bash_setup_script} && conda activate #{environment_name} && #{command}")
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Algorithm is based on
|
|
82
|
+
# https://bioinformatics.stackexchange.com/a/11226
|
|
83
|
+
# but completely recoded in Ruby. Like the poster, if the package is
|
|
84
|
+
# actually managed by conda, we assume that all the potential infos (for
|
|
85
|
+
# various architectures, versions of python, etc) have the same license.
|
|
86
|
+
def conda_list
|
|
87
|
+
command = 'conda list'
|
|
88
|
+
stdout, stderr, status = activated_conda(command)
|
|
89
|
+
|
|
90
|
+
if status.success?
|
|
91
|
+
conda_list = []
|
|
92
|
+
stdout.each_line do |line|
|
|
93
|
+
next if line =~ /^\s*#/
|
|
94
|
+
|
|
95
|
+
name, version, build, channel = line.split
|
|
96
|
+
conda_list << {
|
|
97
|
+
'name' => name,
|
|
98
|
+
'version' => version,
|
|
99
|
+
'build' => build,
|
|
100
|
+
'channel' => channel
|
|
101
|
+
}
|
|
102
|
+
end
|
|
103
|
+
conda_list
|
|
104
|
+
else
|
|
105
|
+
log_errors_with_cmd command, stderr
|
|
106
|
+
[]
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def conda_search_info(list_entry)
|
|
111
|
+
command = 'conda search --info --json '
|
|
112
|
+
command += "--channel #{list_entry['channel']} " if list_entry['channel'] && !list_entry['channel'].empty?
|
|
113
|
+
command += "'#{list_entry['name']} #{list_entry['version']}'"
|
|
114
|
+
|
|
115
|
+
# Errors from conda (in --json mode, at least) show up in stdout, not stderr
|
|
116
|
+
stdout, _stderr, status = activated_conda(command)
|
|
117
|
+
|
|
118
|
+
name = list_entry['name']
|
|
119
|
+
|
|
120
|
+
if status.success?
|
|
121
|
+
JSON(stdout).fetch(name).first
|
|
122
|
+
else
|
|
123
|
+
log_errors_with_cmd command, stdout
|
|
124
|
+
list_entry
|
|
125
|
+
end
|
|
126
|
+
rescue KeyError
|
|
127
|
+
logger.info('Conda', "Key error trying to find #{name} in\n#{JSON(stdout)}")
|
|
128
|
+
list_entry
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LicenseFinder
|
|
4
|
+
class CondaPackage < Package
|
|
5
|
+
attr_accessor :identifier, :json
|
|
6
|
+
|
|
7
|
+
def initialize(conda_json)
|
|
8
|
+
@json = conda_json
|
|
9
|
+
@identifier = Identifier.from_hash(conda_json)
|
|
10
|
+
super(@identifier.name,
|
|
11
|
+
@identifier.version,
|
|
12
|
+
spec_licenses: Package.license_names_from_standard_spec(conda_json),
|
|
13
|
+
children: children)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def ==(other)
|
|
17
|
+
other.is_a?(CondaPackage) && @identifier == other.identifier
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def to_s
|
|
21
|
+
@identifier.to_s
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def package_manager
|
|
25
|
+
'Conda'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def package_url
|
|
29
|
+
@json['url']
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def children
|
|
33
|
+
@json.fetch('depends', []).map { |constraint| constraint.split.first }
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class Identifier
|
|
37
|
+
attr_accessor :name, :version
|
|
38
|
+
|
|
39
|
+
def initialize(name, version)
|
|
40
|
+
@name = name
|
|
41
|
+
@version = version
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.from_hash(hash)
|
|
45
|
+
name = hash['name']
|
|
46
|
+
version = hash['version']
|
|
47
|
+
return nil if name.nil? || version.nil?
|
|
48
|
+
|
|
49
|
+
Identifier.new(name, version)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def ==(other)
|
|
53
|
+
other.is_a?(Identifier) && @name == other.name && @version == other.version
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def eql?(other)
|
|
57
|
+
self == other
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def hash
|
|
61
|
+
[@name, @version].hash
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def <=>(other)
|
|
65
|
+
sort_name = @name <=> other.name
|
|
66
|
+
sort_name.zero? ? @version <=> other.version : sort_name
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def to_s
|
|
70
|
+
"#{@name} - #{@version}"
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -4,7 +4,8 @@ module LicenseFinder
|
|
|
4
4
|
class Scanner
|
|
5
5
|
PACKAGE_MANAGERS = [
|
|
6
6
|
GoModules, GoDep, GoWorkspace, Go15VendorExperiment, Glide, Gvt, Govendor, Trash, Dep, Bundler, NPM, Pip,
|
|
7
|
-
Yarn, Bower, Maven, Gradle, CocoaPods, Rebar, Erlangmk, Nuget, Carthage, Mix, Conan, Sbt, Cargo, Dotnet, Composer, Pipenv
|
|
7
|
+
Yarn, Bower, Maven, Gradle, CocoaPods, Rebar, Erlangmk, Nuget, Carthage, Mix, Conan, Sbt, Cargo, Dotnet, Composer, Pipenv,
|
|
8
|
+
Conda
|
|
8
9
|
].freeze
|
|
9
10
|
|
|
10
11
|
class << self
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: license_finder
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.10.
|
|
4
|
+
version: 6.10.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Collins
|
|
@@ -27,7 +27,7 @@ authors:
|
|
|
27
27
|
autorequire:
|
|
28
28
|
bindir: bin
|
|
29
29
|
cert_chain: []
|
|
30
|
-
date:
|
|
30
|
+
date: 2021-01-08 00:00:00.000000000 Z
|
|
31
31
|
dependencies:
|
|
32
32
|
- !ruby/object:Gem::Dependency
|
|
33
33
|
name: bundler
|
|
@@ -437,6 +437,7 @@ files:
|
|
|
437
437
|
- lib/license_finder/package_managers/cocoa_pods.rb
|
|
438
438
|
- lib/license_finder/package_managers/composer.rb
|
|
439
439
|
- lib/license_finder/package_managers/conan.rb
|
|
440
|
+
- lib/license_finder/package_managers/conda.rb
|
|
440
441
|
- lib/license_finder/package_managers/dep.rb
|
|
441
442
|
- lib/license_finder/package_managers/dotnet.rb
|
|
442
443
|
- lib/license_finder/package_managers/erlangmk.rb
|
|
@@ -475,6 +476,7 @@ files:
|
|
|
475
476
|
- lib/license_finder/packages/cocoa_pods_package.rb
|
|
476
477
|
- lib/license_finder/packages/composer_package.rb
|
|
477
478
|
- lib/license_finder/packages/conan_package.rb
|
|
479
|
+
- lib/license_finder/packages/conda_package.rb
|
|
478
480
|
- lib/license_finder/packages/erlangmk_package.rb
|
|
479
481
|
- lib/license_finder/packages/go_package.rb
|
|
480
482
|
- lib/license_finder/packages/gradle_package.rb
|
|
@@ -531,7 +533,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
531
533
|
- !ruby/object:Gem::Version
|
|
532
534
|
version: '0'
|
|
533
535
|
requirements: []
|
|
534
|
-
rubygems_version: 3.
|
|
536
|
+
rubygems_version: 3.2.4
|
|
535
537
|
signing_key:
|
|
536
538
|
specification_version: 4
|
|
537
539
|
summary: Audit the OSS licenses of your application's dependencies.
|