home-assistant: make parse-requirements.py detect more packages
This commit is contained in:
parent
0577bc4832
commit
b1603e951e
@ -52,10 +52,16 @@ packages = json.loads(output)
|
|||||||
|
|
||||||
def name_to_attr_path(req):
|
def name_to_attr_path(req):
|
||||||
attr_paths = []
|
attr_paths = []
|
||||||
pattern = re.compile('python3\\.6-{}-\\d'.format(req), re.I)
|
names = [req]
|
||||||
for attr_path, package in packages.items():
|
# E.g. python-mpd2 is actually called python3.6-mpd2
|
||||||
if pattern.match(package['name']):
|
# instead of python-3.6-python-mpd2 inside Nixpkgs
|
||||||
attr_paths.append(attr_path)
|
if req.startswith('python-'):
|
||||||
|
names.append(req[len('python-'):])
|
||||||
|
for name in names:
|
||||||
|
pattern = re.compile('^python\\d\\.\\d-{}-\\d'.format(name), re.I)
|
||||||
|
for attr_path, package in packages.items():
|
||||||
|
if pattern.match(package['name']):
|
||||||
|
attr_paths.append(attr_path)
|
||||||
# Let's hope there's only one derivation with a matching name
|
# Let's hope there's only one derivation with a matching name
|
||||||
assert(len(attr_paths) <= 1)
|
assert(len(attr_paths) <= 1)
|
||||||
if attr_paths:
|
if attr_paths:
|
||||||
@ -64,6 +70,7 @@ def name_to_attr_path(req):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
version = get_version()
|
version = get_version()
|
||||||
|
print('Generating component-packages.nix for version {}'.format(version))
|
||||||
requirements = fetch_reqs(version=version)
|
requirements = fetch_reqs(version=version)
|
||||||
build_inputs = {}
|
build_inputs = {}
|
||||||
for component, reqs in requirements.items():
|
for component, reqs in requirements.items():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user