git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #38577 from etu/openzwave

openzwave & pythonPackages.python_openzwave: init at 20180404 and 0.4.4

commit492ab201c454eb2b81fb658cd74229d1a32587ec authorRobert Schütz <rschuetz17@gmail.com> dateTue 10 Apr 2018, 08:39 (9 years ago) parent1034aa8a292149
7 files changed+110−9
pkgs/development/libraries/openzwave/default.nix+56 pkgs/development/python-modules/python_openzwave/default.nix+40 pkgs/servers/home-assistant/component-packages.nix+4−4 pkgs/servers/home-assistant/default.nix+1−1 pkgs/servers/home-assistant/parse-requirements.py+5−4 pkgs/top-level/all-packages.nix+2 pkgs/top-level/python-packages.nix+2
pkgs/development/libraries/openzwave/default.nixnew file+56
@@ -0,0 +1,56 @@
1+{ stdenv, fetchFromGitHub
2+, doxygen, fontconfig, graphviz-nox, libxml2, pkgconfig, which
3+, systemd }:
4+
5+let
6+ version = "2018-04-04";
7+
8+in stdenv.mkDerivation rec {
9+ name = "openzwave-${version}";
10+
11+ src = fetchFromGitHub {
12+ owner = "OpenZWave";
13+ repo = "open-zwave";
14+ rev = "ab5fe966fee882bb9e8d78a91db892a60a1863d9";
15+ sha256 = "0yby8ygzjn5zp5vhysxaadbzysqanwd2zakz379299qs454pr2h9";
16+ };
17+
18+ nativeBuildInputs = [ doxygen fontconfig graphviz-nox libxml2 pkgconfig which ];
19+
20+ buildInputs = [ systemd ];
21+
22+ enableParallelBuilding = true;
23+
24+ installPhase = ''
25+ runHook preInstall
26+
27+ DESTDIR=$out PREFIX= pkgconfigdir=lib/pkgconfig make install $installFlags
28+
29+ runHook postInstall
30+ '';
31+
32+ FONTCONFIG_FILE="${fontconfig.out}/etc/fonts/fonts.conf";
33+ FONTCONFIG_PATH="${fontconfig.out}/etc/fonts/";
34+
35+ postPatch = ''
36+ substituteInPlace cpp/src/Options.cpp \
37+ --replace /etc/openzwave $out/etc/openzwave
38+ '';
39+
40+ fixupPhase = ''
41+ substituteInPlace $out/lib/pkgconfig/libopenzwave.pc \
42+ --replace prefix= prefix=$out \
43+ --replace dir= dir=$out
44+
45+ substituteInPlace $out/bin/ozw_config \
46+ --replace pcfile=${pkgconfig} pcfile=$out
47+ '';
48+
49+ meta = with stdenv.lib; {
50+ description = "C++ library to control Z-Wave Networks via a USB Z-Wave Controller";
51+ homepage = http://www.openzwave.net/;
52+ license = licenses.gpl3;
53+ maintainers = with maintainers; [ etu ];
54+ platforms = platforms.linux;
55+ };
56+}
pkgs/development/python-modules/python_openzwave/default.nixnew file+40
@@ -0,0 +1,40 @@
1+{ stdenv, buildPythonPackage, fetchPypi, isPy3k
2+, pkgconfig
3+, systemd, libyaml, openzwave, cython
4+, six, pydispatcher, urwid }:
5+
6+buildPythonPackage rec {
7+ pname = "python_openzwave";
8+ version = "0.4.4";
9+
10+ disabled = !isPy3k;
11+
12+ src = fetchPypi {
13+ inherit pname version;
14+ sha256 = "17wdgwg212agj1gxb2kih4cvhjb5bprir4x446s8qwx0mz03azk2";
15+ extension = "zip";
16+ };
17+
18+ nativeBuildInputs = [ pkgconfig ];
19+ buildInputs = [ systemd libyaml openzwave cython ];
20+ propagatedBuildInputs = [ six urwid pydispatcher ];
21+
22+ # primary location for the .xml files is in /etc/openzwave so we override the
23+ # /usr/local/etc lookup instead as that allows us to dump new .xml files into
24+ # /etc/openzwave if needed
25+ postPatch = ''
26+ substituteInPlace src-lib/libopenzwave/libopenzwave.pyx \
27+ --replace /usr/local/etc/openzwave ${openzwave}/etc/openzwave
28+ '';
29+
30+ # no tests available
31+ doCheck = false;
32+
33+ meta = with stdenv.lib; {
34+ description = "Python wrapper for the OpenZWave C++ library";
35+ homepage = https://github.com/OpenZWave/python-openzwave;
36+ license = licenses.gpl3Plus;
37+ maintainers = with maintainers; [ etu ];
38+ inherit (openzwave.meta) platforms;
39+ };
40+}
pkgs/servers/home-assistant/component-packages.nix+4−4
@@ -112,8 +112,8 @@
112112 "hue" = ps: with ps; [ ];
113113 "ifttt" = ps: with ps; [ ];
114114 "ihc" = ps: with ps; [ ];
115− "image_processing.dlib_face_detect" = ps: with ps; [ ];
116− "image_processing.dlib_face_identify" = ps: with ps; [ ];
115+ "image_processing.dlib_face_detect" = ps: with ps; [ face_recognition ];
116+ "image_processing.dlib_face_identify" = ps: with ps; [ face_recognition ];
117117 "image_processing.opencv" = ps: with ps; [ numpy ];
118118 "influxdb" = ps: with ps; [ influxdb ];
119119 "insteon_local" = ps: with ps; [ ];
@@ -172,7 +172,7 @@
172172 "media_player.dunehd" = ps: with ps; [ ];
173173 "media_player.emby" = ps: with ps; [ ];
174174 "media_player.frontier_silicon" = ps: with ps; [ ];
175− "media_player.gpmdp" = ps: with ps; [ ];
175+ "media_player.gpmdp" = ps: with ps; [ websocket_client ];
176176 "media_player.gstreamer" = ps: with ps; [ ];
177177 "media_player.kodi" = ps: with ps; [ jsonrpc-async jsonrpc-websocket ];
178178 "media_player.lg_netcast" = ps: with ps; [ ];
@@ -447,6 +447,6 @@
447447 "zeroconf" = ps: with ps; [ zeroconf ];
448448 "zha" = ps: with ps; [ ];
449449 "zigbee" = ps: with ps; [ ];
450− "zwave" = ps: with ps; [ pydispatcher ];
450+ "zwave" = ps: with ps; [ pydispatcher python_openzwave ];
451451 };
452452}
pkgs/servers/home-assistant/default.nix+1−1
@@ -45,7 +45,7 @@ let
4545
4646 getPackages = component: builtins.getAttr component componentPackages.components;
4747
48− componentBuildInputs = map (component: getPackages component py.pkgs) extraComponents;
48+ componentBuildInputs = lib.concatMap (component: getPackages component py.pkgs) extraComponents;
4949
5050 # Ensure that we are using a consistent package set
5151 extraBuildInputs = extraPackages py.pkgs;
pkgs/servers/home-assistant/parse-requirements.py+5−4
@@ -1,5 +1,5 @@
11#! /usr/bin/env nix-shell
2−#! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ setuptools ])"
2+#! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ ])"
33#
44# This script downloads https://github.com/home-assistant/home-assistant/blob/master/requirements_all.txt.
55# This file contains lines of the form
@@ -20,7 +20,6 @@ import os
2020import sys
2121import json
2222import re
23−from pkg_resources import Requirement, RequirementParseError
2423
2524GENERAL_PREFIX = '# homeassistant.'
2625COMPONENT_PREFIX = GENERAL_PREFIX + 'components.'
@@ -64,9 +63,11 @@ def name_to_attr_path(req):
6463 names = [req]
6564 # E.g. python-mpd2 is actually called python3.6-mpd2
6665 # instead of python-3.6-python-mpd2 inside Nixpkgs
67− if req.startswith('python-'):
66+ if req.startswith('python-') or req.startswith('python_'):
6867 names.append(req[len('python-'):])
6968 for name in names:
69+ # treat "-" and "_" equally
70+ name = re.sub('[-_]', '[-_]', name)
7071 pattern = re.compile('^python\\d\\.\\d-{}-\\d'.format(name), re.I)
7172 for attr_path, package in packages.items():
7273 if pattern.match(package['name']):
@@ -86,7 +87,7 @@ for component, reqs in OrderedDict(sorted(requirements.items())).items():
8687 attr_paths = []
8788 for req in reqs:
8889 try:
89− name = Requirement.parse(req).project_name
90+ name = req.split('==')[0]
9091 attr_path = name_to_attr_path(name)
9192 if attr_path is not None:
9293 # Add attribute path without "python3Packages." prefix
pkgs/top-level/all-packages.nix+2
@@ -20598,6 +20598,8 @@ with pkgs;
2059820598
2059920599 moltengamepad = callPackage ../misc/drivers/moltengamepad { };
2060020600
20601+ openzwave = callPackage ../development/libraries/openzwave { };
20602+
2060120603 mongoc = callPackage ../development/libraries/mongoc { };
2060220604
2060320605 mupen64plus = callPackage ../misc/emulators/mupen64plus { };
pkgs/top-level/python-packages.nix+2
@@ -8908,6 +8908,8 @@ in {
89088908
89098909 python-oauth2 = callPackage ../development/python-modules/python-oauth2 { };
89108910
8911+ python_openzwave = callPackage ../development/python-modules/python_openzwave { };
8912+
89118913 python-Levenshtein = buildPythonPackage rec {
89128914 name = "python-Levenshtein-${version}";
89138915 version = "0.12.0";