Skip to content
This repository was archived by the owner on Oct 7, 2022. It is now read-only.

Commit 9902135

Browse files
committed
skip setuptools
1 parent 99eb8b8 commit 9902135

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/pypi2nix/stage2.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import pip.index
99
import pip.req
1010

11-
from pypi2nix.utils import curry
11+
from pypi2nix.utils import TO_IGNORE, curry
1212

1313

1414
SESSION = 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

src/pypi2nix/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import subprocess
55

66

7+
TO_IGNORE = ["setuptools"]
8+
79
PYTHON_VERSIONS = {
810
"2.6": "python26",
911
"2.7": "python27",

0 commit comments

Comments
 (0)