mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-05 09:11:39 -05:00

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.
25 lines
491 B
Python
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)
|