mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
maintain the fallabck because I am totally sick of this crap
This commit is contained in:
parent
7455d0da9b
commit
be1a7659a3
1 changed files with 17 additions and 14 deletions
|
@ -165,21 +165,24 @@ def _check_pkg_version_format(pkg):
|
|||
)
|
||||
)
|
||||
return ret
|
||||
|
||||
if install_req.req is None:
|
||||
# This is most likely an url and there's no way to know what will
|
||||
# be installed before actually installing it.
|
||||
ret['result'] = True
|
||||
ret['prefix'] = ''
|
||||
ret['version_spec'] = []
|
||||
else:
|
||||
ret['result'] = True
|
||||
ret['prefix'] = re.sub('[^A-Za-z0-9.]+', '-', install_req.name)
|
||||
if hasattr(install_req, "specifier"):
|
||||
specifier = install_req.specifier
|
||||
try:
|
||||
ret['prefix'] = install_req.req.project_name
|
||||
ret['version_spec'] = install_req.req.specs
|
||||
except Exception:
|
||||
if install_req.req is None:
|
||||
# This is most likely an url and there's no way to know what will
|
||||
# be installed before actually installing it.
|
||||
ret['result'] = True
|
||||
ret['prefix'] = ''
|
||||
ret['version_spec'] = []
|
||||
else:
|
||||
specifier = install_req.req.specifier
|
||||
ret['version_spec'] = [(spec.operator, spec.version) for spec in specifier]
|
||||
ret['result'] = True
|
||||
ret['prefix'] = re.sub('[^A-Za-z0-9.]+', '-', install_req.name)
|
||||
if hasattr(install_req, "specifier"):
|
||||
specifier = install_req.specifier
|
||||
else:
|
||||
specifier = install_req.req.specifier
|
||||
ret['version_spec'] = [(spec.operator, spec.version) for spec in specifier]
|
||||
|
||||
return ret
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue