Pārlūkot izejas kodu

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

5.0
Glenn Jocher GitHub pirms 3 gadiem
vecāks
revīzija
f59f80114c
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
1 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. +3
    -3
      utils/general.py

+ 3
- 3
utils/general.py Parādīt failu

@@ -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



Notiek ielāde…
Atcelt
Saglabāt