зеркало из https://github.com/getsops/sops.git
Check for latest version on pypi, fixes #31
This commit is contained in:
Родитель
9cb14037f7
Коммит
abde6d26b7
|
@ -140,8 +140,14 @@ def main():
|
|||
dest='ignore_mac',
|
||||
help="ignore Message Authentication Code "
|
||||
"during decryption")
|
||||
argparser.add_argument('--no-latest-check', action='store_true',
|
||||
dest='nolatestcheck',
|
||||
help="skip check for latest version of sops")
|
||||
args = argparser.parse_args()
|
||||
|
||||
if not args.nolatestcheck:
|
||||
check_latest_version()
|
||||
|
||||
kms_arns = ""
|
||||
if 'SOPS_KMS_ARN' in os.environ:
|
||||
kms_arns = os.environ['SOPS_KMS_ARN']
|
||||
|
@ -1000,5 +1006,22 @@ def panic(msg, error_code=1):
|
|||
sys.exit(error_code)
|
||||
|
||||
|
||||
def check_latest_version():
|
||||
try:
|
||||
import xmlrpclib
|
||||
except ImportError:
|
||||
import xmlrpc.client as xmlrpclib
|
||||
try:
|
||||
client = xmlrpclib.ServerProxy('https://pypi.python.org/pypi')
|
||||
latest = client.package_releases('sops')[0]
|
||||
if VERSION < float(latest):
|
||||
print("INFO: your version of sops is outdated. Version {latest} "
|
||||
"is available, install it with "
|
||||
"$ pip install 'sops=={latest}'."
|
||||
.format(latest=latest), file=sys.stderr)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Загрузка…
Ссылка в новой задаче