diff --git a/scripts/depmanage.py b/scripts/depmanage.py deleted file mode 100755 index a051a442610bcb851ece87793610b147ec9eafa7..0000000000000000000000000000000000000000 --- a/scripts/depmanage.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -#------------------------------------------------------------------------------- -# This file is part of Mentat system (https://mentat.cesnet.cz/). -# -# Copyright (C) since 2011 CESNET, z.s.p.o (http://www.ces.net/) -# Use of this source is governed by the MIT license, see LICENSE file. -#------------------------------------------------------------------------------- - - -""" -Utility script for installing/upgrading Python3 library dependencies. -""" - - -__author__ = "Jan Mach <jan.mach@cesnet.cz>" - - -import sys -import subprocess -import argparse - - -VERBOSE = 0 - - -def verbose_print(msg, level = 1): - """ - Print given message, but only in case global ``VERBOSE`` flag is set. - """ - global VERBOSE - if VERBOSE >= level: - print(msg) - - -if __name__ == "__main__": - parser = argparse.ArgumentParser( - description = 'Install/upgrade Python3 library dependencies' - ) - - # Mandatory positional arguments. - parser.add_argument("action", help="which action to perform", choices=['install', 'upgrade'], default='install', nargs='?') - - # Optional arguments. - parser.add_argument('--verbose', '-v', default=0, action='count', help='increase output verbosity') - - args = parser.parse_args() - - #--------------------------------------------------------------------------- - - VERBOSE = args.verbose - - required = ('ply','pynspect','pydgets','pyzenkit','ipranges','typedcols','idea-format') - - if args.action == 'install': - for lib in required: - verbose_print("Installing required library: '{}'".format(lib)) - try: - cmd = "pip3 install {}".format(lib) - retcode = subprocess.call(cmd, shell=True) - if retcode < 0: - print("Library installation terminated by signal", -retcode, file=sys.stderr) - else: - print("Library installation status [{}]".format(retcode), file=sys.stderr) - - except OSError as e: - print("Execution failed:", e, file=sys.stderr) - - elif args.action == 'upgrade': - for lib in required: - verbose_print("Upgrading required library: '{}'".format(lib)) - try: - cmd = "pip3 install {} --upgrade".format(lib) - retcode = subprocess.call(cmd, shell=True) - if retcode < 0: - print("Library update terminated by signal", -retcode, file=sys.stderr) - else: - print("Library upgrade status [{}]".format(retcode), file=sys.stderr) - - except OSError as e: - print("Execution failed:", e, file=sys.stderr)