From 51d1aad9f3a10ccbabdb013f3c9f067bca4f23d8 Mon Sep 17 00:00:00 2001 From: Robert Schütz Date: Sun, 8 Apr 2018 11:59:07 +0200 Subject: home-assistant: treat "-" and "_" equally in parse-requirements.py --- pkgs/servers/home-assistant/component-packages.nix | 8 ++++---- pkgs/servers/home-assistant/parse-requirements.py | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pkgs/servers/home-assistant/component-packages.nix b/pkgs/servers/home-assistant/component-packages.nix index 5372b577e335..852b210ba159 100644 --- a/pkgs/servers/home-assistant/component-packages.nix +++ b/pkgs/servers/home-assistant/component-packages.nix @@ -112,8 +112,8 @@ "hue" = ps: with ps; [ ]; "ifttt" = ps: with ps; [ ]; "ihc" = ps: with ps; [ ]; - "image_processing.dlib_face_detect" = ps: with ps; [ ]; - "image_processing.dlib_face_identify" = ps: with ps; [ ]; + "image_processing.dlib_face_detect" = ps: with ps; [ face_recognition ]; + "image_processing.dlib_face_identify" = ps: with ps; [ face_recognition ]; "image_processing.opencv" = ps: with ps; [ numpy ]; "influxdb" = ps: with ps; [ influxdb ]; "insteon_local" = ps: with ps; [ ]; @@ -172,7 +172,7 @@ "media_player.dunehd" = ps: with ps; [ ]; "media_player.emby" = ps: with ps; [ ]; "media_player.frontier_silicon" = ps: with ps; [ ]; - "media_player.gpmdp" = ps: with ps; [ ]; + "media_player.gpmdp" = ps: with ps; [ websocket_client ]; "media_player.gstreamer" = ps: with ps; [ ]; "media_player.kodi" = ps: with ps; [ jsonrpc-async jsonrpc-websocket ]; "media_player.lg_netcast" = ps: with ps; [ ]; @@ -447,6 +447,6 @@ "zeroconf" = ps: with ps; [ zeroconf ]; "zha" = ps: with ps; [ ]; "zigbee" = ps: with ps; [ ]; - "zwave" = ps: with ps; [ pydispatcher ]; + "zwave" = ps: with ps; [ pydispatcher python_openzwave ]; }; } diff --git a/pkgs/servers/home-assistant/parse-requirements.py b/pkgs/servers/home-assistant/parse-requirements.py index 87ef65482ab6..46e7acee1782 100755 --- a/pkgs/servers/home-assistant/parse-requirements.py +++ b/pkgs/servers/home-assistant/parse-requirements.py @@ -1,5 +1,5 @@ #! /usr/bin/env nix-shell -#! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ setuptools ])" +#! nix-shell -i python3 -p "python3.withPackages (ps: with ps; [ ])" # # This script downloads https://github.com/home-assistant/home-assistant/blob/master/requirements_all.txt. # This file contains lines of the form @@ -20,7 +20,6 @@ import os import sys import json import re -from pkg_resources import Requirement, RequirementParseError GENERAL_PREFIX = '# homeassistant.' COMPONENT_PREFIX = GENERAL_PREFIX + 'components.' @@ -64,9 +63,11 @@ def name_to_attr_path(req): names = [req] # E.g. python-mpd2 is actually called python3.6-mpd2 # instead of python-3.6-python-mpd2 inside Nixpkgs - if req.startswith('python-'): + if req.startswith('python-') or req.startswith('python_'): names.append(req[len('python-'):]) for name in names: + # treat "-" and "_" equally + name = re.sub('[-_]', '[-_]', name) pattern = re.compile('^python\\d\\.\\d-{}-\\d'.format(name), re.I) for attr_path, package in packages.items(): if pattern.match(package['name']): @@ -86,7 +87,7 @@ for component, reqs in OrderedDict(sorted(requirements.items())).items(): attr_paths = [] for req in reqs: try: - name = Requirement.parse(req).project_name + name = req.split('==')[0] attr_path = name_to_attr_path(name) if attr_path is not None: # Add attribute path without "python3Packages." prefix -- cgit 1.4.1