bibliothecary 8.8.0 → 8.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1780d8940244ee5e96aab6ad08266b28f1bfac65eabb9ae2fc811712ddbbb3a
4
- data.tar.gz: ac03558d5e3f9f127664c8420f31273b3eacfefccc4c193c1aa6830f2b54f749
3
+ metadata.gz: dc9dd3ee94e4de1a66c6dabac392832a1ba6805dbef22398665697a85bc8a420
4
+ data.tar.gz: 800a427c7e9fbe6d12d116c1c0e57373136421dd99b6fc272218fad3c47db72d
5
5
  SHA512:
6
- metadata.gz: 0ba1a48525ff6a464715b4d8210d5edf6269a31a785d2038f9228e5b591e83c128ff9adb33bc12d427da134afafb5e1b3808092f272105a7896e1db8895e67f6
7
- data.tar.gz: 3737f2812866ea2d79f94d5c1dfecfcfb822ec2496d8eb013319d72d3218e8e4deb988232b046886ee616688f9cebd6c5c131186f8db2289bd3b372eb3dd8a67
6
+ metadata.gz: d8da425a16d0378c3a73658df752804af3f9c78d31eccb7a26e0abf0b469f0dfa9c8a1d17f907c77255015499e9f947b1b63823641762be161cb4248afb8a2b6
7
+ data.tar.gz: 16d78e7dc17c53d79a6b634dde2ca7b73d8cccaa9db4435956ef752de6fa7c73a6d92a8486576beab838bc12a328016274ca850f2b54ed7e875110c1e38f0a74
@@ -9,8 +9,8 @@ module Bibliothecary
9
9
  # Optional Group 2 is [extras].
10
10
  # Capture Group 3 is Version
11
11
  REQUIRE_REGEXP = /([a-zA-Z0-9]+[a-zA-Z0-9\-_\.]+)(?:\[.*?\])*([><=\w\.,]+)?/
12
-
13
12
  REQUIREMENTS_REGEXP = /^#{REQUIRE_REGEXP}/
13
+
14
14
  MANIFEST_REGEXP = /.*require[^\/]*(\/)?[^\/]*\.(txt|pip|in)$/
15
15
  # TODO: can this be a more specific regexp so it doesn't match something like ".yarn/cache/create-require-npm-1.0.0.zip"?
16
16
  PIP_COMPILE_REGEXP = /.*require.*$/
@@ -45,6 +45,10 @@ module Bibliothecary
45
45
  kind: "lockfile",
46
46
  parser: :parse_requirements_txt,
47
47
  },
48
+ match_filename("pip-dependency-graph.json") => { # Exported from pipdeptree --json
49
+ kind: "lockfile",
50
+ parser: :parse_dependency_tree_json,
51
+ },
48
52
  match_filename("setup.py") => {
49
53
  kind: "manifest",
50
54
  parser: :parse_setup_py,
@@ -226,6 +230,18 @@ module Bibliothecary
226
230
  # should be treated as.
227
231
  NoEggSpecified = Class.new(ArgumentError)
228
232
 
233
+ def self.parse_dependency_tree_json(file_contents, options: {})
234
+ JSON.parse(file_contents)
235
+ .map do |pkg|
236
+ {
237
+ name: pkg.dig("package", "package_name"),
238
+ requirement: pkg.dig("package", "installed_version"),
239
+ type: "runtime",
240
+ }
241
+ end
242
+ .uniq
243
+ end
244
+
229
245
  # Parses a requirements.txt file, following the
230
246
  # https://pip.pypa.io/en/stable/cli/pip_install/#requirement-specifiers
231
247
  # and https://pip.pypa.io/en/stable/topics/vcs-support/#git.
@@ -252,10 +268,7 @@ module Bibliothecary
252
268
  deps << result.merge(
253
269
  type: type
254
270
  )
255
- else
256
- match = line.delete(" ").match(REQUIREMENTS_REGEXP)
257
- next unless match
258
-
271
+ elsif (match = line.delete(" ").match(REQUIREMENTS_REGEXP))
259
272
  deps << {
260
273
  name: match[1],
261
274
  requirement: match[-1] || "*",
@@ -263,7 +276,8 @@ module Bibliothecary
263
276
  }
264
277
  end
265
278
  end
266
- deps
279
+
280
+ deps.uniq
267
281
  end
268
282
 
269
283
  def self.parse_requirements_txt_url(url)
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "8.8.0"
2
+ VERSION = "8.8.1"
3
3
  end
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.8.0
4
+ version: 8.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-09 00:00:00.000000000 Z
11
+ date: 2024-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tomlrb
@@ -248,7 +248,7 @@ dependencies:
248
248
  - - ">="
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
- description:
251
+ description:
252
252
  email:
253
253
  - andrewnez@gmail.com
254
254
  executables:
@@ -326,7 +326,7 @@ homepage: https://github.com/librariesio/bibliothecary
326
326
  licenses:
327
327
  - AGPL-3.0
328
328
  metadata: {}
329
- post_install_message:
329
+ post_install_message:
330
330
  rdoc_options: []
331
331
  require_paths:
332
332
  - lib
@@ -341,8 +341,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
341
341
  - !ruby/object:Gem::Version
342
342
  version: '0'
343
343
  requirements: []
344
- rubygems_version: 3.1.6
345
- signing_key:
344
+ rubygems_version: 3.3.22
345
+ signing_key:
346
346
  specification_version: 4
347
347
  summary: Find and parse manifests
348
348
  test_files: []