From 7d1752c931ea15d939c640bbcde28c24ae3944c8 Mon Sep 17 00:00:00 2001 From: Jonathan Bouzekri Date: Sat, 13 Mar 2021 14:07:00 +0100 Subject: [PATCH] py3 import package from pypi support for multiple module names --- Utility/Python/import_py3package_from_pypi.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Utility/Python/import_py3package_from_pypi.py b/Utility/Python/import_py3package_from_pypi.py index adcca9c..8e6eed3 100644 --- a/Utility/Python/import_py3package_from_pypi.py +++ b/Utility/Python/import_py3package_from_pypi.py @@ -7,7 +7,7 @@ subscription_id (-s) - Subscription id of the Automation account resource_group (-g) - Resource group name of the Automation account automation_account (-a) - Automation account name - module_name (-m) - Name of module to import from pypi.org + module_name (-m) - Name of module to import from pypi.org (supports comma separated list of names) Imports module Example: import_python3package_from_pypi.py -s xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx -g contosogroup -a contosoaccount -m pytz @@ -102,7 +102,7 @@ def import_package_with_dependencies (packagename): if __name__ == '__main__': if len(sys.argv) < 9: - raise Exception("Requires Subscription id -s, Automation resource group name -g, account name -a, and module name -g as arguments. \ + raise Exception("Requires Subscription id -s, Automation resource group name -g, account name -a, and module name -m as arguments. \ Example: -s xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx -g contosogroup -a contosoaccount -m pytz ") # Process any arguments sent in @@ -126,5 +126,6 @@ def import_package_with_dependencies (packagename): token = get_automation_runas_token() # Import package with dependencies from pypi.org - import_package_with_dependencies(module_name) + for module_name in module_name.split(','): + import_package_with_dependencies(module_name) print ("\nCheck the python 3 packages page for import status...")