gnu: gpsd: Install python modules and scripts.

* gnu/packages/gps.scm (gpsd)[native-inputs]: Remove python and add bc.
  [inputs]: Add python, python-pycairo, python-pygobject,
  python-pyserial, python-wrapper and qtbase.
  [arguments]: Update scons-flags, remove fix-paths phase, improve fix-build
  phase and add wrap-python-scripts phase.
This commit is contained in:
Guillaume Le Vaillant 2020-03-17 13:27:56 +01:00
parent 3c0456c6b5
commit 8ee8eb2698
No known key found for this signature in database
GPG key ID: 6BE8208ADF21FE3F

View file

@ -27,7 +27,9 @@ (define-module (gnu packages gps)
#:use-module (guix build-system gnu)
#:use-module (guix build-system scons)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (gnu packages algebra)
#:use-module (gnu packages base)
#:use-module (gnu packages compression)
#:use-module (gnu packages docbook)
@ -39,6 +41,7 @@ (define-module (gnu packages gps)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages qt)
#:use-module (gnu packages sqlite)
#:use-module (gnu packages xml))
@ -227,64 +230,57 @@ (define-public gpsd
(base32 "0faz2mvk82hi7ispxxih07lhpyz5dazs4gcknym9piiabga29p97"))))
(build-system scons-build-system)
(native-inputs
`(("pkg-config" ,pkg-config)
("python" ,python)))
`(("bc" ,bc)
("pkg-config" ,pkg-config)))
(inputs
`(("bluez" ,bluez)
("dbus" ,dbus)
("libcap" ,libcap)
("libusb" ,libusb)
("ncurses" ,ncurses)))
("ncurses" ,ncurses)
("python" ,python)
("python-pycairo" ,python-pycairo)
("python-pygobject" ,python-pygobject)
("python-pyserial" ,python-pyserial)
("python-wrapper" ,python-wrapper)
("qtbase" ,qtbase)))
(arguments
`(#:scons-flags (list (string-append "prefix=" %output)
;; TODO: Install python bindings.
"python=no")
`(#:scons-flags
(list (string-append "prefix=" %output)
(let ((version ,(version-major+minor (package-version python))))
(string-append "python_libdir=" %output
"/lib/python" version
"/site-packages"))
"qt_versioned=5")
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'fix-paths
(lambda* (#:key inputs #:allow-other-keys)
(let ((python3 (string-append (assoc-ref inputs "python")
"/bin/python3")))
(substitute* '("contrib/gpsData.py"
"contrib/ntpshmviz"
"contrib/skyview2svg"
"contrib/webgps.py"
"devtools/ais.py"
"devtools/aivdmtable"
"devtools/cycle_analyzer"
"devtools/flocktest"
"devtools/identify_failing_build_options.py"
"devtools/regress-builder"
"devtools/regressdiff"
"devtools/sizes"
"devtools/striplog"
"devtools/tablegen.py"
"devtools/test_json_validity.py"
"devtools/uninstall_cleanup.py"
"gegps"
"gps/gps.py"
"gpscat"
"gpsfake"
"gpsprof"
"jsongen.py"
"leapsecond.py"
"maskaudit.py"
"test_maidenhead.py"
"test_misc.py"
"test_xgps_deps.py"
"ubxtool"
"valgrind-audit.py"
"xgps"
"xgpsspeed"
"zerk")
(("/usr/bin/python") python3)
(("/usr/bin/env python") python3)))
#t))
(add-after 'fix-paths 'fix-build
(lambda _
(add-after 'unpack 'fix-build
(lambda* (#:key outputs #:allow-other-keys)
(substitute* "SConstruct"
(("'PATH'")
"'PATH','CPATH','LIBRARY_PATH'"))
(("envs = \\{\\}")
"envs = os.environ"))
#t))
(add-after 'install 'wrap-python-scripts
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(pycairo (assoc-ref inputs "python-pycairo"))
(pygobject (assoc-ref inputs "python-pygobject"))
(pyserial (assoc-ref inputs "python-pyserial"))
(sitedir (lambda (package)
(string-append package
"/lib/python"
,(version-major+minor
(package-version python))
"/site-packages")))
(pythonpath (string-join (map sitedir
(list out pycairo pygobject
pyserial))
":")))
(for-each (lambda (script)
(wrap-program (string-append out "/bin/" script)
`("PYTHONPATH" ":" prefix (,pythonpath))))
'("gegps" "gpscat" "gpsfake" "gpsprof"
"ubxtool" "xgps" "xgpsspeed" "zerk")))
#t)))))
(synopsis "GPS service daemon")
(description