Simpler Python requirements check (#11939)

Don't require the full requirements.txt
If we do that we are likely to send users back to the python2 support branch when new dependencies arise.
This commit is contained in:
Tony Murray
2020-07-17 17:12:18 -05:00
committed by GitHub
parent c1418c12af
commit 334d50467c

View File

@ -9,21 +9,18 @@ args = sys.argv
# verbose flag
verbose = '-v' in args
target = os.path.realpath(os.path.dirname(__file__) + '/../requirements.txt')
requirements = [
'PyMySQL'
]
with open(target, 'r') as file:
requirements = file.read().rstrip().split("\n")
requirements.reverse() # reverse so the most important ones show first
try:
pkg_resources.require(requirements)
except DistributionNotFound as req:
if verbose:
print(req)
exit(1)
except VersionConflict as req:
if verbose:
print(req)
exit(2)
exit(0)
exit(3)
try:
pkg_resources.require(requirements)
except DistributionNotFound as req:
if verbose:
print(req)
exit(1)
except VersionConflict as req:
if verbose:
print(req)
exit(2)
exit(0)