Script/gen_requirements: Ignore package families (#12963)
* Added fnmatch for IGNORE_PACKAGE_FAMILIES
This commit is contained in:
parent
6d7dbe5536
commit
eaf525d41d
1 changed files with 6 additions and 7 deletions
|
@ -5,6 +5,7 @@ import os
|
||||||
import pkgutil
|
import pkgutil
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import fnmatch
|
||||||
|
|
||||||
COMMENT_REQUIREMENTS = (
|
COMMENT_REQUIREMENTS = (
|
||||||
'RPi.GPIO',
|
'RPi.GPIO',
|
||||||
|
@ -93,12 +94,7 @@ TEST_REQUIREMENTS = (
|
||||||
|
|
||||||
IGNORE_PACKAGES = (
|
IGNORE_PACKAGES = (
|
||||||
'homeassistant.components.recorder.models',
|
'homeassistant.components.recorder.models',
|
||||||
'homeassistant.components.homekit.accessories',
|
'homeassistant.components.homekit.*'
|
||||||
'homeassistant.components.homekit.covers',
|
|
||||||
'homeassistant.components.homekit.security_systems',
|
|
||||||
'homeassistant.components.homekit.sensors',
|
|
||||||
'homeassistant.components.homekit.switches',
|
|
||||||
'homeassistant.components.homekit.thermostats'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
IGNORE_PIN = ('colorlog>2.1,<3', 'keyring>=9.3,<10.0', 'urllib3')
|
IGNORE_PIN = ('colorlog>2.1,<3', 'keyring>=9.3,<10.0', 'urllib3')
|
||||||
|
@ -164,7 +160,10 @@ def gather_modules():
|
||||||
try:
|
try:
|
||||||
module = importlib.import_module(package)
|
module = importlib.import_module(package)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
if package not in IGNORE_PACKAGES:
|
for pattern in IGNORE_PACKAGES:
|
||||||
|
if fnmatch.fnmatch(package, pattern):
|
||||||
|
break
|
||||||
|
else:
|
||||||
errors.append(package)
|
errors.append(package)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue