From b5964ec35e259f36550d6e8c7fa60412db05a049 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 11 Jun 2020 13:41:49 -0700 Subject: [PATCH 1/1] Build like a real Python package --- default.nix | 11 +++++++++++ pinch.py | 3 ++- setup.py | 8 ++++++++ shell.nix | 10 ---------- 4 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 default.nix create mode 100644 setup.py delete mode 100644 shell.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..942ef10 --- /dev/null +++ b/default.nix @@ -0,0 +1,11 @@ +{ pkgs ? import { } }: +pkgs.python3Packages.callPackage +({ lib, buildPythonPackage, nix, git, autopep8, mypy, pylint, }: + buildPythonPackage rec { + pname = "pinch"; + version = "1.3"; + src = lib.cleanSource ./.; + checkInputs = [ nix git autopep8 mypy pylint ]; + doCheck = true; + checkPhase = "./test.sh"; + }) { } diff --git a/pinch.py b/pinch.py index b761313..5f25015 100644 --- a/pinch.py +++ b/pinch.py @@ -602,4 +602,5 @@ def main() -> None: args.func(args) -main() +if __name__ == '__main__': + main() diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..f8647e6 --- /dev/null +++ b/setup.py @@ -0,0 +1,8 @@ +from setuptools import setup + +setup( + name="pinch", + version="1.4", + py_modules=['pinch'], + entry_points={"console_scripts": ["pinch = pinch:main"]}, +) diff --git a/shell.nix b/shell.nix deleted file mode 100644 index b408ea4..0000000 --- a/shell.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs ? import { } }: -pkgs.mkShell rec { - doCheck = true; - buildInputs = with pkgs; [ python3 ]; - checkInputs = with pkgs; [ - mypy - python3Packages.autopep8 - python3Packages.pylint - ]; -} -- 2.44.1