From 170be6d8d19dfcf1b35800c9e2e8db2089e5ab45 Mon Sep 17 00:00:00 2001 From: brgcode Date: Wed, 9 Nov 2022 22:55:19 +0100 Subject: [PATCH 1/2] fix problem with unrecognized command line arguments --- src/compas_ghpython/components/__init__.py | 10 +--------- src/compas_rhino/__init__.py | 2 ++ src/compas_rhino/install.py | 3 ++- src/compas_rhino/install_plugin.py | 3 --- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/compas_ghpython/components/__init__.py b/src/compas_ghpython/components/__init__.py index 6e95d107846..906d5f76217 100644 --- a/src/compas_ghpython/components/__init__.py +++ b/src/compas_ghpython/components/__init__.py @@ -22,7 +22,6 @@ """ from __future__ import absolute_import -import argparse import glob import os @@ -34,14 +33,7 @@ def get_version_from_args(): - parser = argparse.ArgumentParser() - parser.add_argument( - "-v", - "--version", - choices=compas_rhino.SUPPORTED_VERSIONS, - default=compas_rhino.DEFAULT_VERSION, - ) - args = parser.parse_args() + args = compas_rhino.INSTALLATION_ARGUMENTS return _check_rhino_version(args.version) diff --git a/src/compas_rhino/__init__.py b/src/compas_rhino/__init__.py index b43f9999617..c172b6a3038 100644 --- a/src/compas_rhino/__init__.py +++ b/src/compas_rhino/__init__.py @@ -38,6 +38,8 @@ SUPPORTED_VERSIONS = ["5.0", "6.0", "7.0", "8.0"] DEFAULT_VERSION = "7.0" +INSTALLATION_ARGUMENTS = None + IRONPYTHON_PLUGIN_GUID = "814d908a-e25c-493d-97e9-ee3861957f49" GRASSHOPPER_PLUGIN_GUID = "b45a29b1-4343-4035-989e-044e8580d9cf" RHINOCYCLES_PLUGIN_GUID = "9bc28e9e-7a6c-4b8f-a0c6-3d05e02d1b97" diff --git a/src/compas_rhino/install.py b/src/compas_rhino/install.py index 28e56fc4582..b500a353927 100644 --- a/src/compas_rhino/install.py +++ b/src/compas_rhino/install.py @@ -372,8 +372,9 @@ def _filter_installable_packages(version, packages): help="The version of Rhino to install the packages in.", ) parser.add_argument("-p", "--packages", nargs="+", help="The packages to install.") - parser.add_argument("--clean", dest="clean", default=False, action="store_true") + parser.add_argument("-c", "--clean", default=False, action="store_true", help="Clean up the installation directory") args = parser.parse_args() + compas_rhino.INSTALLATION_ARGUMENTS = args install(version=args.version, packages=args.packages, clean=args.clean) diff --git a/src/compas_rhino/install_plugin.py b/src/compas_rhino/install_plugin.py index 0f244f668cf..b793decd8e0 100644 --- a/src/compas_rhino/install_plugin.py +++ b/src/compas_rhino/install_plugin.py @@ -8,9 +8,6 @@ from .install import install as install_packages -__all__ = ["install_plugin"] - - def install_plugin(plugin, version=None): """Install a Rhino Python Command Plugin. From fb10772e16c2fee74f7af6a270e1fcc61561f314 Mon Sep 17 00:00:00 2001 From: brgcode Date: Wed, 9 Nov 2022 22:59:53 +0100 Subject: [PATCH 2/2] log --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b44ecc20fdb..67a3db5ab1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +* Added `compas_rhino.INSTALLATION_ARGUMENTS`. + ### Changed +* Fixed bug in Rhino installation due to redefinition of command line arguments in `compas_ghpython.components.get_version_from_args`. + ### Removed