diff options
| -rw-r--r-- | wigust/packages/python.scm | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/wigust/packages/python.scm b/wigust/packages/python.scm index 6c63890..a23fdb6 100644 --- a/wigust/packages/python.scm +++ b/wigust/packages/python.scm @@ -249,3 +249,60 @@ Integration") (description "A Supercharged Git/Shell Autocompleter with GitHub Integration.") (license license:gpl3+))) +(define-public python-hosts + (let ((commit "b42c9ea692ab36a96fb0f2804a7440eca406e36c") + (revision "1")) + (package + (name "python-hosts") + (version "0.1.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/StevenBlack/hosts.git") + (commit commit))) + (file-name (string-append name "-" version "-checkout")) + (sha256 + (base32 + "04hanv6cwp23wvaz1hd1niz2wk2vrr3z0nsa9wiqp5fpxch5rmiz")))) + (build-system trivial-build-system) + (inputs `(("python" ,python))) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils)) + (let ((bin (string-append %output "/bin")) + (share-hosts (string-append %output "/share/hosts"))) + (copy-recursively (assoc-ref %build-inputs "source") ".") + (let ((python-files (find-files "." "\\.py")) + (wrapper (string-append bin "/updateHostsFile"))) + ;; Patch Python shebangs + (substitute* python-files + (("/usr/bin/env python") + (string-append (assoc-ref %build-inputs "python") + "/bin/python3")) + (("/etc/hosts") "/tmp/hosts")) + ;; Install + (copy-recursively "data" (string-append share-hosts "/data")) + (for-each (lambda (file) (install-file file share-hosts)) + python-files) + ;; Wrapper + (mkdir-p bin) + (with-output-to-file wrapper + (lambda () + (display + (string-join `("#!/bin/sh" + ,(string-join `("cd" ,share-hosts)) + ,(string-join '("exec" + "-a" "updateHostsFile" + "./updateHostsFile.py" + "\"$@\""))) + "\n")))) + (for-each (lambda (file) (chmod file #o555)) + (append (list wrapper) + (find-files share-hosts "\\.py"))))) + #t))) + (home-page "https://github.com/StevenBlack/hosts.git") + (synopsis "Extending @code{hosts} file from several sources") + (description "Extending @code{hosts} file from several sources") + (license license:expat)))) |
