--- /dev/null
+{ pkgs ? import <nixpkgs> { }, lint ? false }:
+pkgs.python3Packages.callPackage
+({ lib, buildPythonPackage, autopep8, mypy, pylint, }:
+ buildPythonPackage rec {
+ pname = "nix-pin-deps";
+ version = "1.0.0";
+ src = lib.cleanSource ./.;
+ checkInputs = [ mypy ] ++ lib.optionals lint [ autopep8 pylint ];
+ doCheck = true;
+ checkPhase = ''
+ ./test.sh ${lib.optionalString lint "lint"}
+ '';
+ }) { }
--- /dev/null
+from setuptools import setup
+
+setup(
+ name='nix-pin-deps',
+ version='1.0.0',
+ py_modules=['nix_pin_deps'],
+ entry_points={'console_scripts': ['nix-pin-deps = nix_pin_deps:main']},
+)
--- /dev/null
+#!/bin/sh
+
+set -e
+
+find . -name build -prune -o -name dist -prune -o -name '*.py' -print0 |
+ xargs -0 mypy --strict --ignore-missing-imports --no-warn-unused-ignores
+
+if [ "$1" = lint ];then
+
+ pylint --reports=n --persistent=n --ignore-imports=y \
+ -d fixme,invalid-name,missing-docstring,subprocess-run-check,too-few-public-methods *.py
+
+ formatting_needs_fixing=$(
+ find . -name '*.py' -print0 |
+ xargs -0 -n1 autopep8 --diff -aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+ )
+ if [[ "$formatting_needs_fixing" ]];then
+ echo "Formatting needs fixing:"
+ echo "$formatting_needs_fixing"
+ exit 1
+ fi
+
+fi