bibliothecary 8.2.3 → 8.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bibliothecary/analyser/determinations.rb +6 -0
- data/lib/bibliothecary/file_info.rb +4 -0
- data/lib/bibliothecary/multi_parsers/cyclonedx.rb +4 -2
- data/lib/bibliothecary/multi_parsers/dependencies_csv.rb +1 -0
- data/lib/bibliothecary/parsers/pypi.rb +43 -8
- data/lib/bibliothecary/related_files_info.rb +8 -1
- 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: 77204631e2bfcd808b697fa06b39e9b026b59231bb4acd705af42c5b36b36001
|
4
|
+
data.tar.gz: 712424873beece9fca7c15fbde387ff0f11a12973b0a785c8d94ac8cd833b9ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eb8cad8145bef3d6fb87c713e2cc145a6ca75be9a65b9c81f09c551552c9c8a40a95f7e192dcb7585f9a2ef15d3233522de367b23135fa503704b37c1b8bf06
|
7
|
+
data.tar.gz: f29c04901db7650463e80a7a0436a629001a9758ae6e21a38683091f4d30a1d76424bd2a3e8ec944ec526801fd5a6122a2940cf333e74a37f6e8c5be019e4f2b
|
@@ -22,6 +22,12 @@ module Bibliothecary
|
|
22
22
|
first_matching_mapping_details(info)
|
23
23
|
.fetch(:can_have_lockfile, true)
|
24
24
|
end
|
25
|
+
|
26
|
+
def groupable?(info)
|
27
|
+
# More package managers are groupable than ungroupable, but the methods
|
28
|
+
# to get this information should be positive.
|
29
|
+
!first_matching_mapping_details(info).fetch(:ungroupable, false)
|
30
|
+
end
|
25
31
|
end
|
26
32
|
end
|
27
33
|
end
|
@@ -98,11 +98,13 @@ module Bibliothecary
|
|
98
98
|
{
|
99
99
|
match_filename('cyclonedx.json') => {
|
100
100
|
kind: 'lockfile',
|
101
|
-
parser: :parse_cyclonedx_json
|
101
|
+
parser: :parse_cyclonedx_json,
|
102
|
+
ungroupable: true
|
102
103
|
},
|
103
104
|
match_filename('cyclonedx.xml') => {
|
104
105
|
kind: 'lockfile',
|
105
|
-
parser: :parse_cyclonedx_xml
|
106
|
+
parser: :parse_cyclonedx_xml,
|
107
|
+
ungroupable: true
|
106
108
|
}
|
107
109
|
}
|
108
110
|
end
|
@@ -84,7 +84,7 @@ module Bibliothecary
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def self.parse_poetry(file_contents, options: {})
|
87
|
-
manifest = Tomlrb.parse(file_contents)
|
87
|
+
manifest = Tomlrb.parse(file_contents).fetch('tool', {}).fetch('poetry', {})
|
88
88
|
map_dependencies(manifest['dependencies'], 'runtime') + map_dependencies(manifest['dev-dependencies'], 'develop')
|
89
89
|
end
|
90
90
|
|
@@ -179,20 +179,55 @@ module Bibliothecary
|
|
179
179
|
deps
|
180
180
|
end
|
181
181
|
|
182
|
+
# While the thing in the repo that PyPI is using might be either in
|
183
|
+
# egg format or wheel format, PyPI uses "egg" in the fragment of the
|
184
|
+
# VCS URL to specify what package in the PyPI index the VCS URL
|
185
|
+
# should be treated as.
|
186
|
+
NoEggSpecified = Class.new(ArgumentError)
|
187
|
+
|
188
|
+
# Parses a requirements.txt file, following the
|
189
|
+
# https://pip.pypa.io/en/stable/cli/pip_install/#requirement-specifiers
|
190
|
+
# and https://pip.pypa.io/en/stable/topics/vcs-support/#git.
|
191
|
+
# Invalid lines in requirements.txt are skipped.
|
182
192
|
def self.parse_requirements_txt(file_contents, options: {})
|
183
193
|
deps = []
|
184
194
|
file_contents.split("\n").each do |line|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
195
|
+
if line['://']
|
196
|
+
begin
|
197
|
+
result = parse_requirements_txt_url(line)
|
198
|
+
rescue URI::Error, NoEggSpecified => e
|
199
|
+
next
|
200
|
+
end
|
201
|
+
|
202
|
+
deps << result.merge(
|
203
|
+
type: 'runtime'
|
204
|
+
)
|
205
|
+
else
|
206
|
+
match = line.delete(' ').match(REQUIREMENTS_REGEXP)
|
207
|
+
next unless match
|
208
|
+
|
209
|
+
deps << {
|
210
|
+
name: match[1],
|
211
|
+
requirement: match[-1] || '*',
|
212
|
+
type: 'runtime'
|
213
|
+
}
|
214
|
+
end
|
192
215
|
end
|
193
216
|
deps
|
194
217
|
end
|
195
218
|
|
219
|
+
def self.parse_requirements_txt_url(url)
|
220
|
+
uri = URI.parse(url)
|
221
|
+
raise NoEggSpecified, "No egg specified in #{url}" unless uri.fragment
|
222
|
+
|
223
|
+
name = uri.fragment[/^egg=([^&]+)([&]|$)/, 1]
|
224
|
+
raise NoEggSpecified, "No egg specified in #{url}" unless name
|
225
|
+
|
226
|
+
requirement = uri.path[/@(.+)$/, 1]
|
227
|
+
|
228
|
+
{ name: name, requirement: requirement || "*" }
|
229
|
+
end
|
230
|
+
|
196
231
|
def self.pip_compile?(file_contents)
|
197
232
|
return file_contents.include?("This file is autogenerated by pip-compile")
|
198
233
|
rescue Exception # rubocop:disable Lint/RescueException
|
@@ -12,7 +12,14 @@ module Bibliothecary
|
|
12
12
|
|
13
13
|
file_infos_by_directory = file_infos.group_by { |info| File.dirname(info.relative_path) }
|
14
14
|
file_infos_by_directory.values.each do |file_infos_for_path|
|
15
|
-
|
15
|
+
groupable, ungroupable = file_infos_for_path.partition(&:groupable?)
|
16
|
+
|
17
|
+
# add ungroupable ones as separate RFIs
|
18
|
+
ungroupable.each do |file_info|
|
19
|
+
returns.append(RelatedFilesInfo.new([file_info]))
|
20
|
+
end
|
21
|
+
|
22
|
+
file_infos_by_directory_by_package_manager = groupable.group_by { |info| info.package_manager}
|
16
23
|
|
17
24
|
file_infos_by_directory_by_package_manager.values.each do |file_infos_in_directory_for_package_manager|
|
18
25
|
returns.append(RelatedFilesInfo.new(file_infos_in_directory_for_package_manager))
|
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: 8.2.
|
4
|
+
version: 8.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tomlrb
|