diff options
author | Robert Schütz <robert.schuetz@stud.uni-heidelberg.de> | 2018-04-05 09:59:13 +0200 |
---|---|---|
committer | Robert Schütz <rschuetz17@gmail.com> | 2018-04-05 10:16:16 +0200 |
commit | f198ca19d996a072752a677ace97e987f4120d15 (patch) | |
tree | 36aeaa6114a6ffcd915e0146a7438f31e2560fba /pkgs/servers/home-assistant/parse-requirements.py | |
parent | 749d280c2cc4e983468f5d40900efcbfd00e0c7e (diff) | |
download | nixpkgs-f198ca19d996a072752a677ace97e987f4120d15.tar nixpkgs-f198ca19d996a072752a677ace97e987f4120d15.tar.gz nixpkgs-f198ca19d996a072752a677ace97e987f4120d15.tar.bz2 nixpkgs-f198ca19d996a072752a677ace97e987f4120d15.tar.lz nixpkgs-f198ca19d996a072752a677ace97e987f4120d15.tar.xz nixpkgs-f198ca19d996a072752a677ace97e987f4120d15.tar.zst nixpkgs-f198ca19d996a072752a677ace97e987f4120d15.zip |
home-assistant: support requirements that are commented out
Diffstat (limited to 'pkgs/servers/home-assistant/parse-requirements.py')
-rwxr-xr-x | pkgs/servers/home-assistant/parse-requirements.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/pkgs/servers/home-assistant/parse-requirements.py b/pkgs/servers/home-assistant/parse-requirements.py index 791b8c03980..87ef65482ab 100755 --- a/pkgs/servers/home-assistant/parse-requirements.py +++ b/pkgs/servers/home-assistant/parse-requirements.py @@ -22,7 +22,8 @@ import json import re from pkg_resources import Requirement, RequirementParseError -PREFIX = '# homeassistant.components.' +GENERAL_PREFIX = '# homeassistant.' +COMPONENT_PREFIX = GENERAL_PREFIX + 'components.' PKG_SET = 'python3Packages' def get_version(): @@ -37,12 +38,16 @@ def fetch_reqs(version='master'): for line in response.read().decode().splitlines(): if line == '': components = [] - elif line[:len(PREFIX)] == PREFIX: - component = line[len(PREFIX):] + elif line[:len(COMPONENT_PREFIX)] == COMPONENT_PREFIX: + component = line[len(COMPONENT_PREFIX):] components.append(component) if component not in requirements: requirements[component] = [] - elif line[0] != '#': + elif line[:len(GENERAL_PREFIX)] != GENERAL_PREFIX: # skip lines like "# homeassistant.scripts.xyz" + # Some dependencies are commented out because they don't build on all platforms + # Since they are still required for running the component, don't skip them + if line[:2] == '# ': + line = line[2:] # Some requirements are specified by url, e.g. https://example.org/foobar#xyz==1.0.0 # Therefore, if there's a "#" in the line, only take the part after it line = line[line.find('#') + 1:] |