bibliothecary 6.8.3 → 6.8.4
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/lib/bibliothecary/parsers/conda.rb +26 -40
- data/lib/bibliothecary/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f6d0c75dace8b988d53e7b6620e7c1c8aad139ddf4aebbc1497c1428b4bda09
|
|
4
|
+
data.tar.gz: ea3e235adc6e425269eb29fda38694555be29b54bcb5cdc7ec8b455ac06b554c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 191203c29364c6fb45bf9228fa49a1ae3e8f176ec1e7331c07e3bf731688ac896220d49a4271773703ec48a240cdb0fdfc555fd887ed14cd459d2788a285339c
|
|
7
|
+
data.tar.gz: 185c27f488fd30d3026447193396637b90a46c286c7cbf02b207ce0dd1ff30d576c73b5a39262f61ad3fe7bf7975f9df0ef20cfb61701ac532cc969733ef26f2
|
|
@@ -1,67 +1,53 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "json"
|
|
2
2
|
|
|
3
3
|
module Bibliothecary
|
|
4
4
|
module Parsers
|
|
5
5
|
class Conda
|
|
6
6
|
include Bibliothecary::Analyser
|
|
7
|
-
FILE_KINDS = %w[manifest lockfile]
|
|
8
7
|
|
|
9
8
|
def self.mapping
|
|
10
9
|
{
|
|
11
10
|
match_filename("environment.yml") => {
|
|
12
|
-
|
|
11
|
+
parser: :parse_conda,
|
|
12
|
+
kind: "manifest",
|
|
13
13
|
},
|
|
14
14
|
match_filename("environment.yaml") => {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
parser: :parse_conda,
|
|
16
|
+
kind: "manifest",
|
|
17
|
+
},
|
|
18
|
+
match_filename("environment.yml.lock") => {
|
|
19
|
+
parser: :parse_conda_lockfile,
|
|
20
|
+
kind: "lockfile",
|
|
21
|
+
},
|
|
22
|
+
match_filename("environment.yaml.lock") => {
|
|
23
|
+
parser: :parse_conda_lockfile,
|
|
24
|
+
kind: "lockfile",
|
|
25
|
+
},
|
|
17
26
|
}
|
|
18
27
|
end
|
|
19
28
|
|
|
20
|
-
# Overrides Analyser.analyse_contents_from_info
|
|
21
|
-
def self.analyse_contents_from_info(info)
|
|
22
|
-
[parse_conda(info), parse_pip(info)].flatten.compact
|
|
23
|
-
rescue Bibliothecary::RemoteParsingError => e
|
|
24
|
-
Bibliothecary::Analyser::create_error_analysis(platform_name, info.relative_path, "runtime", e.message)
|
|
25
|
-
rescue Psych::SyntaxError => e
|
|
26
|
-
Bibliothecary::Analyser::create_error_analysis(platform_name, info.relative_path, "runtime", e.message)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
private
|
|
30
|
-
|
|
31
29
|
def self.parse_conda(info)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Bibliothecary::Analyser.create_analysis(
|
|
35
|
-
"conda",
|
|
36
|
-
info.relative_path,
|
|
37
|
-
kind,
|
|
38
|
-
results[kind.to_sym].map { |dep| dep.slice(:name, :requirement).merge(type: "runtime") }
|
|
39
|
-
)
|
|
40
|
-
end
|
|
30
|
+
dependencies = call_conda_parser_web(info, :manifest)[:manifest]
|
|
31
|
+
dependencies.map { |dep| dep.merge(type: "runtime") }
|
|
41
32
|
end
|
|
42
33
|
|
|
43
|
-
def self.
|
|
44
|
-
dependencies =
|
|
45
|
-
|
|
46
|
-
return unless pip
|
|
47
|
-
|
|
48
|
-
Bibliothecary::Analyser.create_analysis(
|
|
49
|
-
"pypi",
|
|
50
|
-
info.relative_path,
|
|
51
|
-
"manifest",
|
|
52
|
-
Pypi.parse_requirements_txt(pip["pip"].join("\n"))
|
|
53
|
-
)
|
|
34
|
+
def self.parse_conda_lockfile(info)
|
|
35
|
+
dependencies = call_conda_parser_web(info, :lockfile)[:lockfile]
|
|
36
|
+
dependencies.map { |dep| dep.merge(type: "runtime") }
|
|
54
37
|
end
|
|
55
38
|
|
|
56
|
-
def self.call_conda_parser_web(file_contents)
|
|
39
|
+
private_class_method def self.call_conda_parser_web(file_contents, kind)
|
|
57
40
|
host = Bibliothecary.configuration.conda_parser_host
|
|
58
41
|
response = Typhoeus.post(
|
|
59
42
|
"#{host}/parse",
|
|
60
43
|
headers: {
|
|
61
|
-
|
|
44
|
+
ContentType: "multipart/form-data",
|
|
62
45
|
},
|
|
63
|
-
|
|
64
|
-
|
|
46
|
+
body: {
|
|
47
|
+
file: file_contents,
|
|
48
|
+
# Unfortunately we do not get the filename in the mapping parsers, so hardcoding the file name depending on the kind
|
|
49
|
+
filename: kind == "manifest" ? "environment.yml" : "environment.yml.lock",
|
|
50
|
+
}
|
|
65
51
|
)
|
|
66
52
|
raise Bibliothecary::RemoteParsingError.new("Http Error #{response.response_code} when contacting: #{host}/parse", response.response_code) unless response.success?
|
|
67
53
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bibliothecary
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.8.
|
|
4
|
+
version: 6.8.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Nesbitt
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-10-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: toml-rb
|