diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-10-31 22:19:45 +0100 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-10-31 22:19:45 +0100 |
commit | 78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc (patch) | |
tree | fd9cfb92edfaa37c919be8d24063b8a6c6d94c83 /nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/hooks/pyproject-without-special-deps.py | |
parent | 7e0c8fe656bbc2fcbdfc3e03a367d2c6ff389769 (diff) | |
parent | 0cbe9f69c234a7700596e943bfae7ef27a31b735 (diff) | |
download | nixlib-78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc.tar nixlib-78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc.tar.gz nixlib-78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc.tar.bz2 nixlib-78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc.tar.lz nixlib-78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc.tar.xz nixlib-78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc.tar.zst nixlib-78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc.zip |
Merge commit '0cbe9f69c234a7700596e943bfae7ef27a31b735' into HEAD
Diffstat (limited to 'nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/hooks/pyproject-without-special-deps.py')
-rw-r--r-- | nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/hooks/pyproject-without-special-deps.py | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/hooks/pyproject-without-special-deps.py b/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/hooks/pyproject-without-special-deps.py deleted file mode 100644 index 76f52604e431..000000000000 --- a/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/hooks/pyproject-without-special-deps.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python -# Patch out special dependencies (git and path) from a pyproject.toml file - -import argparse -import sys - -import tomlkit - - -def main(input, output, fields_to_remove): - data = tomlkit.loads(input.read()) - - try: - deps = data["tool"]["poetry"]["dependencies"] - except KeyError: - pass - else: - for dep in deps.values(): - if isinstance(dep, dict): - any_removed = False - for field in fields_to_remove: - any_removed |= dep.pop(field, None) is not None - if any_removed: - dep["version"] = "*" - dep.pop("develop", None) - - output.write(tomlkit.dumps(data)) - - -if __name__ == "__main__": - p = argparse.ArgumentParser() - p.add_argument( - "-i", - "--input", - type=argparse.FileType("r"), - default=sys.stdin, - help="Location from which to read input TOML", - ) - p.add_argument( - "-o", - "--output", - type=argparse.FileType("w"), - default=sys.stdout, - help="Location to write output TOML", - ) - p.add_argument( - "-f", - "--fields-to-remove", - nargs="+", - help="The fields to remove from the dependency's TOML", - ) - - args = p.parse_args() - main(args.input, args.output, args.fields_to_remove) |