diff --git a/ladybug_grasshopper/icon/LB Versioner.png b/ladybug_grasshopper/icon/LB Versioner.png index 17aebeb..05eafac 100644 Binary files a/ladybug_grasshopper/icon/LB Versioner.png and b/ladybug_grasshopper/icon/LB Versioner.png differ diff --git a/ladybug_grasshopper/json/LB_Versioner.json b/ladybug_grasshopper/json/LB_Versioner.json index 37036ee..4244565 100644 --- a/ladybug_grasshopper/json/LB_Versioner.json +++ b/ladybug_grasshopper/json/LB_Versioner.json @@ -1,5 +1,5 @@ { - "version": "1.6.0", + "version": "1.6.1", "nickname": "Versioner", "outputs": [ [] @@ -21,7 +21,7 @@ } ], "subcategory": "5 :: Version", - "code": "\nimport os\nimport tempfile\nimport subprocess\n\ntry:\n from ladybug.config import folders\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.versioning.diff import current_userobject_version\n from ladybug_{{cad}}.versioning.change import latest_github_version\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, give_warning, \\\n give_popup_message, is_user_admin\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component) and _update:\n # get the paths to the executables\n lb_{{cad}}_exe = os.path.join(folders.python_scripts_path, 'ladybug-{{cad}}.exe') \\\n if os.name == 'nt' else os.path.join(folders.python_scripts_path, 'ladybug-{{cad}}')\n executor_path = os.path.join(\n folders.ladybug_tools_folder, '{{plugin}}', 'ladybug_{{plugin}}_dotnet',\n 'Ladybug.Executor.exe')\n\n # run the command to update everything\n if os.name == 'nt' and os.path.isfile(executor_path) and \\\n 'Program Files' in executor_path and not is_user_admin():\n cmd = [\n executor_path, folders.python_exe_path,\n '-m ladybug_{{cad}} change-installed-version'\n ]\n else:\n cmd = [lb_{{cad}}_exe, 'change-installed-version']\n if version_ is not None:\n cmd.extend(['--version', version_])\n use_shell = True if os.name == 'nt' else False\n process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=use_shell)\n cmd_output = process.communicate() # ensure that the canvas is forzen\n stdout = cmd_output[0]\n print(stdout)\n if 'Error' in stdout:\n raise ValueError(stdout)\n\n # give a completion message\n if version_ is None:\n temp_dir = tempfile.gettempdir()\n version_ = latest_github_version('lbt-{{plugin}}', temp_dir)\n version = 'LATEST' if version_ is None else version_\n success_msg = 'Change to Version {} Successful!'.format(version)\n restart_msg = 'RESTART RHINO to load the new components + library.'\n sync_msg = 'The \"LB Sync {{Plugin}} File\" component can be used\\n' \\\n 'to sync {{Plugin}} definitions with your new installation.'\n for msg in (success_msg, restart_msg, sync_msg):\n print (msg)\n give_popup_message('\\n'.join([restart_msg, sync_msg]), success_msg)\n\n # do a check to see if the versioner has, itself, been updated\n new_version = current_userobject_version(ghenv.Component)\n current_version = ghenv.Component.Message\n if new_version != current_version:\n msg = 'The Versioner component has, itself, been changed between the\\n' \\\n 'current version ({}) and the version you are changing to ({}).\\n' \\\n 'It is recommended that you resart {{Cad}} and run the new Versioner\\n' \\\n 'coponent to ensure that everything is consistent.'.format(\n current_version, new_version)\n print (msg)\n give_warning(ghenv.Component, msg)\nelse: # give a message to the user about what to do\n print ('Make sure you are connected to the internet and set _update to True!')\n", + "code": "\nimport os\nimport tempfile\nimport subprocess\n\ntry:\n from ladybug.config import folders\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.versioning.diff import current_userobject_version\n from ladybug_{{cad}}.versioning.change import latest_github_version\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, give_warning, \\\n give_popup_message, is_user_admin\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component) and _update:\n # get the paths to the executables\n lb_{{cad}}_exe = os.path.join(folders.python_scripts_path, 'ladybug-{{cad}}.exe') \\\n if os.name == 'nt' else os.path.join(folders.python_scripts_path, 'ladybug-{{cad}}')\n executor_path = os.path.join(\n folders.ladybug_tools_folder, '{{plugin}}', 'ladybug_{{plugin}}_dotnet',\n 'Ladybug.Executor.exe')\n\n # run the command to update everything\n if os.name == 'nt' and os.path.isfile(executor_path) and \\\n 'Program Files' in executor_path and not is_user_admin():\n cmd = [\n executor_path, folders.python_exe_path,\n '-m ladybug_{{cad}} change-installed-version'\n ]\n else:\n cmd = [lb_{{cad}}_exe, 'change-installed-version']\n if version_ is not None:\n cmd.extend(['--version', version_])\n use_shell = True if os.name == 'nt' else False\n process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=use_shell)\n cmd_output = process.communicate() # ensure that the canvas is frozen\n stdout = cmd_output[0]\n print(stdout)\n if 'Error' in stdout:\n if 'ladybug-{{cad}}.exe' not in stdout:\n raise ValueError(stdout)\n else: # recent Windows permission issue; reinstall ladybug-{{cad}}\n cmd = cmds = [folders.python_exe_path, '-m', 'pip', 'install', 'ladybug-{{cad}}', '-U']\n process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=use_shell)\n cmd_output = process.communicate() # ensure that the canvas is frozen\n\n # give a completion message\n if version_ is None:\n temp_dir = tempfile.gettempdir()\n version_ = latest_github_version('lbt-{{plugin}}', temp_dir)\n version = 'LATEST' if version_ is None else version_\n success_msg = 'Change to Version {} Successful!'.format(version)\n restart_msg = 'RESTART RHINO to load the new components + library.'\n sync_msg = 'The \"LB Sync {{Plugin}} File\" component can be used\\n' \\\n 'to sync {{Plugin}} definitions with your new installation.'\n for msg in (success_msg, restart_msg, sync_msg):\n print (msg)\n give_popup_message('\\n'.join([restart_msg, sync_msg]), success_msg)\n\n # do a check to see if the versioner has, itself, been updated\n new_version = current_userobject_version(ghenv.Component)\n current_version = ghenv.Component.Message\n if new_version != current_version:\n msg = 'The Versioner component has, itself, been changed between the\\n' \\\n 'current version ({}) and the version you are changing to ({}).\\n' \\\n 'It is recommended that you resart {{Cad}} and run the new Versioner\\n' \\\n 'coponent to ensure that everything is consistent.'.format(\n current_version, new_version)\n print (msg)\n give_warning(ghenv.Component, msg)\nelse: # give a message to the user about what to do\n print ('Make sure you are connected to the internet and set _update to True!')\n", "category": "Ladybug", "name": "LB Versioner", "description": "This component updates the Ladybug Tools core libraries and grasshopper components\nto either the latest development version available (default) or to a specific\nversion of the grasshopper plugin.\n_\nThe input version_ does not need to be newer than the current installation and can\nbe older but grasshopper plugin versions less than 0.3.0 are not supported.\nA list of all versions of the Grasshopper plugin and corresponding release notes\ncan be found at: https://github.com/ladybug-tools/lbt-grasshopper/releases\n-" diff --git a/ladybug_grasshopper/src/LB Versioner.py b/ladybug_grasshopper/src/LB Versioner.py index 841c750..5772dfd 100644 --- a/ladybug_grasshopper/src/LB Versioner.py +++ b/ladybug_grasshopper/src/LB Versioner.py @@ -34,7 +34,7 @@ ghenv.Component.Name = 'LB Versioner' ghenv.Component.NickName = 'Versioner' -ghenv.Component.Message = '1.6.0' +ghenv.Component.Message = '1.6.1' ghenv.Component.Category = 'Ladybug' ghenv.Component.SubCategory = '5 :: Version' ghenv.Component.AdditionalHelpFromDocStrings = '1' @@ -78,11 +78,16 @@ cmd.extend(['--version', version_]) use_shell = True if os.name == 'nt' else False process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=use_shell) - cmd_output = process.communicate() # ensure that the canvas is forzen + cmd_output = process.communicate() # ensure that the canvas is frozen stdout = cmd_output[0] print(stdout) if 'Error' in stdout: - raise ValueError(stdout) + if 'ladybug-rhino.exe' not in stdout: + raise ValueError(stdout) + else: # recent Windows permission issue; reinstall ladybug-rhino + cmd = cmds = [folders.python_exe_path, '-m', 'pip', 'install', 'ladybug-rhino', '-U'] + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=use_shell) + cmd_output = process.communicate() # ensure that the canvas is frozen # give a completion message if version_ is None: diff --git a/ladybug_grasshopper/user_objects/LB Versioner.ghuser b/ladybug_grasshopper/user_objects/LB Versioner.ghuser index 772c0b2..8f08f4d 100644 Binary files a/ladybug_grasshopper/user_objects/LB Versioner.ghuser and b/ladybug_grasshopper/user_objects/LB Versioner.ghuser differ