]> git.scottworley.com Git - pinch/commitdiff
Build like a real Python package
authorScott Worley <scottworley@scottworley.com>
Thu, 11 Jun 2020 20:41:49 +0000 (13:41 -0700)
committerScott Worley <scottworley@scottworley.com>
Thu, 11 Jun 2020 23:29:10 +0000 (16:29 -0700)
default.nix [new file with mode: 0644]
pinch.py
setup.py [new file with mode: 0644]
shell.nix [deleted file]

diff --git a/default.nix b/default.nix
new file mode 100644 (file)
index 0000000..942ef10
--- /dev/null
@@ -0,0 +1,11 @@
+{ pkgs ? import <nixpkgs> { } }:
+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";
+  }) { }
index b76131399f6ee9d78188305a739e25c0aebf1b52..5f250150660351cc59da24bb1578790dbf1290b2 100644 (file)
--- 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 (file)
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 (file)
index b408ea4..0000000
--- a/shell.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{ pkgs ? import <nixpkgs> { } }:
-pkgs.mkShell rec {
-  doCheck = true;
-  buildInputs = with pkgs; [ python3 ];
-  checkInputs = with pkgs; [
-    mypy
-    python3Packages.autopep8
-    python3Packages.pylint
-  ];
-}