~singpolyma/signal-sticker-proxy

dc854fa5c6a6205d7b6a286aba5093ef78504f5a — Stephen Paul Weber 3 months ago 1639ed9
Build runnable binary in guix package
1 files changed, 26 insertions(+), 1 deletions(-)

M guix.scm
M guix.scm => guix.scm +26 -1
@@ 3,8 3,10 @@
  (guix packages)
  (guix download)
  (guix git-download)
  (guix build-system copy)
  (guix build-system python)
  (gnu packages protobuf)
  (gnu packages python)
  (gnu packages python-crypto)
  (gnu packages python-web)
  (gnu packages python-xyz)


@@ 87,9 89,32 @@
       (sha256
        (base32
         ,(read-line (open-pipe* OPEN_READ "guix" "hash" "-rx" %source-dir))))))
    (build-system 'python-build-system)
    (build-system 'copy-build-system)
    (arguments
     '`(#:install-plan '(("README.md" ,(string-append "share/doc/signal-sticker-proxy-" version "/")))
        #:phases
       (modify-phases %standard-phases
         (add-after 'install 'runner
           (lambda* (#:key outputs #:allow-other-keys)
             (use-modules (ice-9 textual-ports))
             (let* ((out (assoc-ref outputs "out"))
                    (bindir (string-append out "/bin/")))
               (mkdir-p bindir)
               (let ((binstub (string-append bindir "signal-sticker-proxy")))
                 (call-with-output-file binstub
                   (lambda (port)
                     (format port
                       "#!~a~@
                        import sys~@
                        for path in '~a'.split(':'): sys.path.append(path)~@
                        ~a~%"
                       (which "python3")
                       (getenv "GUIX_PYTHONPATH")
                       (get-string-all (open-input-file "main.py")))))
                 (chmod binstub #o755))))))))
    (inputs
      '(list
        python
        python-aiohttp
        python-pymultihash
        python-magic