poetry2nix/hooks/pyproject-without-path.py
adisbladis b9221f61b5
Automatically build most packages without passing format param
We should never have to use `format = "setuptools"` since pip can
_also_ handle setuptools packages.

This uses a custom pipBuildHook that removes pyproject.toml in case
there is also a setup.py in the same sources.
2020-04-01 00:14:30 +01:00

25 lines
491 B
Python

#!/usr/bin/env python
# Patch out path dependencies from a pyproject.json file
import json
import sys
data = json.load(sys.stdin)
def get_deep(o, path):
for p in path.split('.'):
o = o.get(p, {})
return o
for dep in get_deep(data, 'tool.poetry.dependencies').values():
if isinstance(dep, dict):
try:
del dep['path'];
except KeyError:
pass
else:
dep['version'] = '*'
json.dump(data, sys.stdout, indent=4)