88import pip .index
99import pip .req
1010
11- from pypi2nix .utils import curry
11+ from pypi2nix .utils import TO_IGNORE , curry
1212
1313
1414SESSION = pip .download .PipSession ()
@@ -37,18 +37,16 @@ def extract_deps(metadata):
3737 if 'requires' in item :
3838 for line in item ['requires' ]:
3939 components = line .split ()
40- if components [0 ] not in [ 'setuptools' ] :
40+ if components [0 ] not in TO_IGNORE :
4141 if '[' in components [0 ]:
4242 deps .append (components [0 ].split ('[' )[0 ])
4343 else :
4444 deps .append (components [0 ])
4545 return list (set (deps ))
4646
4747
48- def parse (metadata_json ):
48+ def parse (metadata ):
4949 """Parse relevant information out of a metadata.json file."""
50- with open (metadata_json ) as f :
51- metadata = json .load (f )
5250 name = metadata ['name' ]
5351 version = metadata ['version' ]
5452
@@ -83,7 +81,12 @@ def try_candidates(distinfo):
8381 for cand in ('metadata.json' , 'pydist.json' ):
8482 fn = p .join (distinfo , cand )
8583 if p .exists (fn ):
86- return parse (fn )
84+ with open (fn ) as f :
85+ metadata = json .load (f )
86+ if metadata ['name' ] in TO_IGNORE :
87+ return
88+ else :
89+ return parse (metadata )
8790 raise click .ClickException ('unable to find json in %s' % distinfo )
8891
8992
@@ -101,5 +104,7 @@ def extract_metadata_from_wheelhouse(wheel_dir):
101104 res = []
102105 for distinfo in glob .glob (p .join (wheel_dir , '*.dist-info' )):
103106 click .secho ('|-> %s' % p .basename (distinfo ), fg = 'blue' )
104- res .append (try_candidates (distinfo ))
107+ tmp = try_candidates (distinfo )
108+ if tmp :
109+ res .append (tmp )
105110 return res
0 commit comments