git.iko.soy/typeable/nixpkgs
on master help sign in
home-assistant: support requirements that are commented out
commitf198ca19d996a072752a677ace97e987f4120d15 authorRobert Schütz <robert.schuetz@stud.uni-heidelberg.de> dateThu 5 Apr 2018, 09:59 (9 years ago) parent749d280
1 file changed+9−4
pkgs/servers/home-assistant/parse-requirements.py+9−4
pkgs/servers/home-assistant/parse-requirements.py+9−4
@@ -22,7 +22,8 @@ import json
2222import re
2323from pkg_resources import Requirement, RequirementParseError
2424
25−PREFIX = '# homeassistant.components.'
25+GENERAL_PREFIX = '# homeassistant.'
26+COMPONENT_PREFIX = GENERAL_PREFIX + 'components.'
2627PKG_SET = 'python3Packages'
2728
2829def get_version():
@@ -37,12 +38,16 @@ def fetch_reqs(version='master'):
3738 for line in response.read().decode().splitlines():
3839 if line == '':
3940 components = []
40− elif line[:len(PREFIX)] == PREFIX:
41− component = line[len(PREFIX):]
41+ elif line[:len(COMPONENT_PREFIX)] == COMPONENT_PREFIX:
42+ component = line[len(COMPONENT_PREFIX):]
4243 components.append(component)
4344 if component not in requirements:
4445 requirements[component] = []
45− elif line[0] != '#':
46+ elif line[:len(GENERAL_PREFIX)] != GENERAL_PREFIX: # skip lines like "# homeassistant.scripts.xyz"
47+ # Some dependencies are commented out because they don't build on all platforms
48+ # Since they are still required for running the component, don't skip them
49+ if line[:2] == '# ':
50+ line = line[2:]
4651 # Some requirements are specified by url, e.g. https://example.org/foobar#xyz==1.0.0
4752 # Therefore, if there's a "#" in the line, only take the part after it
4853 line = line[line.find('#') + 1:]