diff options
author | Robert Schütz <robert.schuetz@stud.uni-heidelberg.de> | 2018-04-10 09:13:36 +0200 |
---|---|---|
committer | Robert Schütz <robert.schuetz@stud.uni-heidelberg.de> | 2018-04-10 09:13:36 +0200 |
commit | 80fc5f2a24fc626218be6b9c24d3bf6ef86444fe (patch) | |
tree | 2fa67fa3181544f6bea4ee8a7f071461c55b4d92 /pkgs/servers/home-assistant/parse-requirements.py | |
parent | 0aa59a08d65461149552f68c638655ed2b474510 (diff) | |
parent | c4f555a505f7cb2e7453459a5c734682532645e4 (diff) | |
download | nixpkgs-80fc5f2a24fc626218be6b9c24d3bf6ef86444fe.tar nixpkgs-80fc5f2a24fc626218be6b9c24d3bf6ef86444fe.tar.gz nixpkgs-80fc5f2a24fc626218be6b9c24d3bf6ef86444fe.tar.bz2 nixpkgs-80fc5f2a24fc626218be6b9c24d3bf6ef86444fe.tar.lz nixpkgs-80fc5f2a24fc626218be6b9c24d3bf6ef86444fe.tar.xz nixpkgs-80fc5f2a24fc626218be6b9c24d3bf6ef86444fe.tar.zst nixpkgs-80fc5f2a24fc626218be6b9c24d3bf6ef86444fe.zip |
Merge branch 'master' into staging
Diffstat (limited to 'pkgs/servers/home-assistant/parse-requirements.py')
-rwxr-xr-x | pkgs/servers/home-assistant/parse-requirements.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pkgs/servers/home-assistant/parse-requirements.py b/pkgs/servers/home-assistant/parse-requirements.py index 87ef65482ab..46e7acee178 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 |