Преглед на файлове

Add 'exclude' tuple to check_requirements() (#2041)

5.0
Glenn Jocher GitHub преди 3 години
родител
ревизия
f59f80114c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. +3
    -3
      utils/general.py

+ 3
- 3
utils/general.py Целия файл

@@ -79,11 +79,11 @@ def check_git_status():
print(e)


def check_requirements(file='requirements.txt'):
def check_requirements(file='requirements.txt', exclude=()):
# Check installed dependencies meet requirements
import pkg_resources
requirements = pkg_resources.parse_requirements(Path(file).open())
requirements = [x.name + ''.join(*x.specs) if len(x.specs) else x.name for x in requirements]
requirements = [f'{x.name}{x.specifier}' for x in pkg_resources.parse_requirements(Path(file).open())
if x.name not in exclude]
pkg_resources.require(requirements) # DistributionNotFound or VersionConflict exception if requirements not met



Loading…
Отказ
Запис