diff --git a/pkgs/additional/sane-scripts/default.nix b/pkgs/additional/sane-scripts/default.nix index 206df8ff5..448c1f0d1 100644 --- a/pkgs/additional/sane-scripts/default.nix +++ b/pkgs/additional/sane-scripts/default.nix @@ -1,5 +1,5 @@ { lib -, pkgs +, python3Packages , static-nix-shell , symlinkJoin }: @@ -13,6 +13,19 @@ let cp -R lib/* $out/bin/lib/ ''; }); + + sane-lib = { + bt = python3Packages.buildPythonPackage { + pname = "sane-lib-bt"; + version = "0.1.0"; + format = "setuptools"; + src = ./src/lib/bt; + pythonImportChecks = [ + "sane_bt" + ]; + }; + }; + nix-shell-scripts = { # anything added to this attrset gets symlink-joined into `sane-scripts` # and is made available through `sane-scripts.passthru` @@ -26,15 +39,17 @@ let src = ./src; pkgs = [ "duplicity" ]; }; - bt-add = pythonWithLib { + bt-add = static-nix-shell.mkPython3Bin { pname = "sane-bt-add"; src = ./src; pkgs = [ "transmission" ]; + pyPkgs = [ "sane-lib.bt" ]; }; bt-rm = pythonWithLib { pname = "sane-bt-rm"; src = ./src; pkgs = [ "transmission" ]; + pyPkgs = [ "sane-lib.bt" ]; }; bt-search = static-nix-shell.mkPython3Bin { pname = "sane-bt-search"; @@ -215,7 +230,9 @@ in symlinkJoin { name = "sane-scripts"; paths = lib.attrValues nix-shell-scripts; - passthru = nix-shell-scripts; + passthru = nix-shell-scripts // { + lib = sane-lib; + }; meta = { description = "collection of scripts associated with sane systems"; homepage = "https://git.uninsane.org"; diff --git a/pkgs/additional/sane-scripts/src/lib/sane_torrent.py b/pkgs/additional/sane-scripts/src/lib/bt/sane_bt.py similarity index 100% rename from pkgs/additional/sane-scripts/src/lib/sane_torrent.py rename to pkgs/additional/sane-scripts/src/lib/bt/sane_bt.py diff --git a/pkgs/additional/sane-scripts/src/lib/bt/setup.py b/pkgs/additional/sane-scripts/src/lib/bt/setup.py new file mode 100644 index 000000000..620ecd4d4 --- /dev/null +++ b/pkgs/additional/sane-scripts/src/lib/bt/setup.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python + +from distutils.core import setup + +setup( + name='sane-lib-bt', + version='0.1.0', + description='utilities for sane-scripts', +) diff --git a/pkgs/additional/sane-scripts/src/sane-bt-add b/pkgs/additional/sane-scripts/src/sane-bt-add index 4b14ab349..ce8b67263 100755 --- a/pkgs/additional/sane-scripts/src/sane-bt-add +++ b/pkgs/additional/sane-scripts/src/sane-bt-add @@ -1,13 +1,10 @@ #!/usr/bin/env nix-shell -#!nix-shell -i python3 -p "python3.withPackages (ps: [ ])" -p transmission +#!nix-shell -i python3 -p "python3.withPackages (ps: [ ps.sane-lib.bt ])" -p transmission # vim: set filetype=python : import argparse -import sys -sys.path.insert(0, ".") # to import `lib` - -from lib.sane_torrent import MediaMeta, TransmissionApi +from sane_bt import MediaMeta, TransmissionApi def main(): diff --git a/pkgs/additional/sane-scripts/src/sane-bt-rm b/pkgs/additional/sane-scripts/src/sane-bt-rm index 5f65de460..8d253783b 100755 --- a/pkgs/additional/sane-scripts/src/sane-bt-rm +++ b/pkgs/additional/sane-scripts/src/sane-bt-rm @@ -1,15 +1,12 @@ #!/usr/bin/env nix-shell -#!nix-shell -i python3 -p "python3.withPackages (ps: [ ])" -p transmission +#!nix-shell -i python3 -p "python3.withPackages (ps: [ ps.sane-lib.bt ])" -p transmission # vim: set filetype=python : # removes a torrent and trashes its data import argparse -import sys -sys.path.insert(0, ".") # to import `lib` - -from lib.sane_torrent import TransmissionApi +from sane_bt import TransmissionApi def main(): diff --git a/pkgs/python-packages/default.nix b/pkgs/python-packages/default.nix index 50c34775b..1512c96c2 100644 --- a/pkgs/python-packages/default.nix +++ b/pkgs/python-packages/default.nix @@ -1,4 +1,5 @@ { callPackage }: { feedsearch-crawler = callPackage ./feedsearch-crawler { }; + sane-lib = (callPackage ../additional/sane-scripts { }).lib; }