From ac078550f41984e30dc3a8fc68908e13e9f6b103 Mon Sep 17 00:00:00 2001 From: Andrea Settimi Date: Tue, 6 Feb 2024 16:10:32 +0100 Subject: [PATCH] REVIEW: final modifications integrated --- README.md | 12 ++++++------ componentize_cpy.py | 6 +++--- examples/cpy/Test_KitchenSink/metadata.json | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 62b3dc2..06db679 100644 --- a/README.md +++ b/README.md @@ -89,18 +89,18 @@ Alternatively, you can also use this tool directly from the command line. Make sure to have IronPython or Python3/pythonnet installed and the `GH_IO.dll` assembly available. Then start the script pointing it to a source and target folder, e.g.: - ipy componentize_ipy.py examples build - python componentize_cpy.py examples build + ipy componentize_ipy.py examples/ipy build + python componentize_cpy.py examples/cpy build Optionally, tag it with a version: - ipy componentize_ipy.py examples build --version 0.1.2 - python componentize_cpy.py examples build --version 0.1.2 + ipy componentize_ipy.py examples/ipy build --version 0.1.2 + python componentize_cpy.py examples/cpy build --version 0.1.2 An optional name prefix can help tell components apart from other similarly named ones: - ipy componentize_ipy.py examples build --prefix "(PACKAGE-NAME)" - python componentize_cpy.py examples build --prefix "(PACKAGE-NAME)" + ipy componentize_ipy.py examples/ipy build --prefix "(PACKAGE-NAME)" + python componentize_cpy.py examples/cpy build --prefix "(PACKAGE-NAME)" ## How to create components diff --git a/componentize_cpy.py b/componentize_cpy.py index 834851c..1428869 100644 --- a/componentize_cpy.py +++ b/componentize_cpy.py @@ -7,7 +7,7 @@ import tempfile import urllib.request, urllib.parse, urllib.error import zipfile -from io import StringIO +from io import BytesIO import clr import System @@ -66,9 +66,9 @@ def fetch_ghio_lib(target_folder="temp"): ghio_dll = "GH_IO.dll" filename = "lib/net48/" + ghio_dll - response = urllib.urlopen("https://www.nuget.org/api/v2/package/Grasshopper/") + response = urllib.request.urlopen("https://www.nuget.org/api/v2/package/Grasshopper/") dst_file = os.path.join(target_folder, ghio_dll) - zip_file = zipfile.ZipFile(StringIO.StringIO(response.read())) + zip_file = zipfile.ZipFile(BytesIO(response.read())) with zip_file.open(filename, "r") as zipped_dll: with open(dst_file, "wb") as fp: diff --git a/examples/cpy/Test_KitchenSink/metadata.json b/examples/cpy/Test_KitchenSink/metadata.json index 86fde85..3cfdda9 100644 --- a/examples/cpy/Test_KitchenSink/metadata.json +++ b/examples/cpy/Test_KitchenSink/metadata.json @@ -11,7 +11,7 @@ "iconDisplay": 2, "inputParameters": [ { - "name": "X", + "name": "x", "nickname": "x", "description": "The X value of the component.", "optional": true, @@ -25,7 +25,7 @@ "simplify": false }, { - "name": "Y", + "name": "x", "nickname": "y", "description": "The Y value of the component.", "optional": true, @@ -38,7 +38,7 @@ "simplify": true }, { - "name": "Z", + "name": "z", "nickname": "z", "description": "The Z value of the component.", "optional": true,