From c727f92492b0d063b1e259113022122a613eeb55 Mon Sep 17 00:00:00 2001 From: anssakthi Date: Thu, 14 Mar 2024 18:22:16 +0530 Subject: [PATCH 01/36] fix style --- doc/source/installer.rst | 65 ++++++++++++-------- linux/debian/installer.sh | 4 +- src/ansys/tools/installer/find_python.py | 4 +- src/ansys/tools/installer/linux_functions.py | 36 ++++++----- src/ansys/tools/installer/uninstall.py | 38 ++++++++++++ 5 files changed, 103 insertions(+), 44 deletions(-) diff --git a/doc/source/installer.rst b/doc/source/installer.rst index 09cb354d..28d0927e 100644 --- a/doc/source/installer.rst +++ b/doc/source/installer.rst @@ -30,12 +30,12 @@ Installing the ``Ansys Python Manager`` #. **OS** supported for **Ubuntu(20.04 and 22.04)**. #. Update ``apt-get`` repository and install the following packages with **sudo** privileges: - **libffi-dev, libssl-dev, libsqlite3-dev, libxcb-xinerama0 and build-essential** packages with **sudo** privileges + **wget, gnome, libffi-dev, libssl-dev, libsqlite3-dev, libxcb-xinerama0 and build-essential** packages with **sudo** privileges .. code:: shell sudo apt-get update -y - sudo apt-get install libffi-dev libssl-dev libsqlite3-dev libxcb-xinerama0 build-essential -y + sudo apt-get install wget gnome libffi-dev libssl-dev libsqlite3-dev libxcb-xinerama0 build-essential -y #. Install **zlib** package @@ -71,12 +71,17 @@ Installing the ``Ansys Python Manager`` #. In the pop up window: - * If you want to remove all the virtual environments as part of - uninstallation, mark ``Delete virtual environment`` checkbox + * If you want to remove all virtual environments which was created by + Ansys Python Manageras part of uninstallation, mark + ``Delete virtual environment`` checkbox - * If you want to remove all the configurations as part of + * If you want to remove all configurations as part of uninstallation, mark ``Delete configurations`` checkbox + * If you want to remove all python installations which was installed by + Ansys Python Manageras as part of uninstallation, mark + ``Delete python installations`` checkbox + #. Click ``Uninstall`` button. @@ -130,12 +135,17 @@ Installing the ``Ansys Python Manager`` #. In the pop up window: - * If you want to remove all the virtual environments as part of - uninstallation, mark ``Delete virtual environment`` checkbox + * If you want to remove all virtual environments which was created by + Ansys Python Manageras part of uninstallation, mark + ``Delete virtual environment`` checkbox - * If you want to remove all the configurations as part of + * If you want to remove all configurations as part of uninstallation, mark ``Delete configurations`` checkbox + * If you want to remove all python installations which was installed by + Ansys Python Manageras as part of uninstallation, mark + ``Delete python installations`` checkbox + #. Click ``Uninstall`` button. #. Follow the uninstaller script & provide sudo permission to uninstall the application. @@ -190,12 +200,17 @@ Installing the ``Ansys Python Manager`` #. In the pop up window: - * If you want to remove all the virtual environments as part of - uninstallation, mark ``Delete virtual environment`` checkbox + * If you want to remove all virtual environments which was created by + Ansys Python Manageras part of uninstallation, mark + ``Delete virtual environment`` checkbox - * If you want to remove all the configurations as part of + * If you want to remove all configurations as part of uninstallation, mark ``Delete configurations`` checkbox + * If you want to remove all python installations which was installed by + Ansys Python Manageras as part of uninstallation, mark + ``Delete python installations`` checkbox + #. Click ``Uninstall`` button. #. Follow the uninstaller script & provide sudo permission to uninstall the application. @@ -241,30 +256,30 @@ Regarding the available Python versions, users can select among the following on 2. Standard python installation happens in two ways: - #. If the Debian version is 22.04 and Python 3.11 (recommended by Ansys) is specified, the installer will - automatically install the pre-compiled version of Python available within the installer. + #. If the Debian version is 22.04 and Python 3.11 (recommended by Ansys) is specified, the installer will + automatically install the pre-compiled version of Python available within the installer. - #. Otherwise, Python will be installed following these steps: + #. Otherwise, Python will be installed following these steps: - #. Download Python Tarball and Untar: + #. Download Python Tarball and Untar: - i. The Python tar file will be downloaded from the Python FTP server (https://www.python.org/ftp/python) - based on the version selected from the dropdown menu. Example: For Python version 3.8.11, the download link - would be here(https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tar.xz). + i. The Python tar file will be downloaded from the Python FTP server (https://www.python.org/ftp/python) + based on the version selected from the dropdown menu. Example: For Python version 3.8.11, the download link + would be here(https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tar.xz). - ii. Decompress the downloaded file in the user’s cache directory. + ii. Decompress the downloaded file in the user’s cache directory. - * Configure the Source: + * Configure the Source: - i. Following will be executed configure the installation: + i. Following will be executed configure the installation: - .. code:: shell + .. code:: shell - ./configure --prefix=~/.local/ansys/{python_folder_name} + ./configure --prefix=~/.local/ansys/{python_folder_name} - * Build and install Python: + * Build and install Python: - i. Build and install Python using the make and make install commands. + i. Build and install Python using the make and make install commands. .. warning:: diff --git a/linux/debian/installer.sh b/linux/debian/installer.sh index ab8e2aaf..c3210dca 100644 --- a/linux/debian/installer.sh +++ b/linux/debian/installer.sh @@ -13,7 +13,7 @@ else dependencies_available=false fi # check other dependencies -arr=("libffi-dev" "libssl-dev" "build-essential" "libsqlite3-dev" "libxcb-xinerama0") +arr=("wget", "gnome", "libffi-dev" "libssl-dev" "build-essential" "libsqlite3-dev" "libxcb-xinerama0") for x in "${arr[@]}"; do c="dpkg -s $x >/dev/null 2>&1" eval $c @@ -69,7 +69,7 @@ else dependencies_available=false fi # check other dependencies - arr=("libffi-dev" "libssl-dev" "build-essential" "libsqlite3-dev" "libxcb-xinerama0") + arr=("wget", "gnome", "libffi-dev" "libssl-dev" "build-essential" "libsqlite3-dev" "libxcb-xinerama0") for x in "${arr[@]}"; do c="dpkg -s $x >/dev/null 2>&1" eval $c diff --git a/src/ansys/tools/installer/find_python.py b/src/ansys/tools/installer/find_python.py index 3b41a215..3031a469 100644 --- a/src/ansys/tools/installer/find_python.py +++ b/src/ansys/tools/installer/find_python.py @@ -31,7 +31,7 @@ from ansys.tools.installer.configure_json import ConfigureJson from ansys.tools.installer.constants import ANSYS_SUPPORTED_PYTHON_VERSIONS from ansys.tools.installer.linux_functions import ( - find_installed_python_linux, + find_ansys_installed_python_linux, find_miniforge_linux, is_linux_os, ) @@ -235,7 +235,7 @@ def find_all_python(): paths.update(_find_installed_ansys_python_win()) else: paths = _find_installed_python_linux() - paths.update(find_installed_python_linux()) + paths.update(find_ansys_installed_python_linux()) return paths diff --git a/src/ansys/tools/installer/linux_functions.py b/src/ansys/tools/installer/linux_functions.py index ce221e6e..6225ffc1 100644 --- a/src/ansys/tools/installer/linux_functions.py +++ b/src/ansys/tools/installer/linux_functions.py @@ -139,10 +139,15 @@ def install_python_linux(filename): return 0 -def find_miniforge_linux(): +def find_miniforge_linux(ansys_manager_installed_only=False): """ Find miniforge installation on the host machine. + Parameters: + ---------- + ansys_manager_installed_only : Boolean(default: False) + If this value is true, then python installed via Ansys python manager will be returned. + Returns ------- dict @@ -161,18 +166,19 @@ def find_miniforge_linux(): """ paths = {} - try: - subprocess.check_output("printenv | grep CONDA_PYTHON_EXE > /tmp/conda.txt") - with open("/tmp/conda.txt") as f: - conda_system_path = f.read() - conda_system_path = conda_system_path.replace("CONDA_PYTHON_EXE=", "") - conda_system_path = conda_system_path.replace("/bin/python", "").strip() - version = subprocess.check_output([f"conda", "--version"]) - version = version.split()[1].decode("utf-8") - paths[conda_system_path] = (version, True) - os.remove("/tmp/conda.txt") - except: - pass + if not ansys_manager_installed_only: + try: + subprocess.check_output("printenv | grep CONDA_PYTHON_EXE > /tmp/conda.txt") + with open("/tmp/conda.txt") as f: + conda_system_path = f.read() + conda_system_path = conda_system_path.replace("CONDA_PYTHON_EXE=", "") + conda_system_path = conda_system_path.replace("/bin/python", "").strip() + version = subprocess.check_output([f"conda", "--version"]) + version = version.split()[1].decode("utf-8") + paths[conda_system_path] = (version, True) + os.remove("/tmp/conda.txt") + except: + pass try: version = subprocess.check_output( [f"{ansys_linux_path}/conda/bin/conda", "--version"] @@ -302,7 +308,7 @@ def run_linux_command_conda(pypath, extra, venv=False): execute_linux_command(f"cd ~ {venvParam} ; {conda_path}{extra} ", wait=False) -def find_installed_python_linux(): +def find_ansys_installed_python_linux(): """ Find all installed Ansys Python Manager installed Python versions on Linux. @@ -314,7 +320,7 @@ def find_installed_python_linux(): Examples -------- - >>> installed_pythons = find_installed_python_linux() + >>> installed_pythons = find_ansys_installed_python_linux() >>> installed_pythons {'/home/user/python/py311/bin/python': ('3.11.3', False), '/home/user/python/py311/bin/python3': ('3.11.3', False), diff --git a/src/ansys/tools/installer/uninstall.py b/src/ansys/tools/installer/uninstall.py index e93b5dac..8f0eb756 100644 --- a/src/ansys/tools/installer/uninstall.py +++ b/src/ansys/tools/installer/uninstall.py @@ -30,6 +30,8 @@ from ansys.tools.installer.constants import ANSYS_FAVICON, ASSETS_PATH from ansys.tools.installer.linux_functions import ( execute_linux_command, + find_ansys_installed_python_linux, + find_miniforge_linux, get_os_version, is_linux_os, ) @@ -86,6 +88,28 @@ def __init__(self, parent): self.uninstall_window_cache_remove_venv_checkbox ) + # remove installed python + uninstall_window_cache_remove_python_layout = QtWidgets.QHBoxLayout() + uninstall_window_cache_remove_python_text = QtWidgets.QLabel() + uninstall_window_cache_remove_python_text.setText( + "Delete python installations" + ) + uninstall_window_cache_remove_python_text.setTextFormat( + QtCore.Qt.TextFormat.RichText + ) + uninstall_window_cache_remove_python_text.setAlignment( + QtCore.Qt.AlignmentFlag.AlignLeft + ) + + self.uninstall_window_cache_remove_python_checkbox = QtWidgets.QCheckBox() + + uninstall_window_cache_remove_python_layout.addWidget( + uninstall_window_cache_remove_python_text + ) + uninstall_window_cache_remove_python_layout.addWidget( + self.uninstall_window_cache_remove_python_checkbox + ) + # configs uninstall_window_cache_remove_configs_layout = QtWidgets.QHBoxLayout() @@ -113,6 +137,10 @@ def __init__(self, parent): uninstall_window_cache_remove_venv_layout ) + uninstall_window_cache_remove_layout.addLayout( + uninstall_window_cache_remove_python_layout + ) + uninstall_window_cache_remove_layout.addLayout( uninstall_window_cache_remove_configs_layout ) @@ -155,6 +183,9 @@ def _uninstall(self): if self.uninstall_window_cache_remove_venv_checkbox.isChecked(): self._remove_all_venvs() + if self.uninstall_window_cache_remove_python_checkbox.isChecked(): + self._remove_all_installed_python() + if self.uninstall_window_cache_remove_configs_checkbox.isChecked(): self._remove_configs() @@ -170,6 +201,13 @@ def _uninstall(self): self._parent.uninstall_window.close() self._parent.close_emit() + def _remove_all_installed_python(self): + for path in find_ansys_installed_python_linux(): + path = path.split("bin")[0] + shutil.rmtree(path, ignore_errors=True) + for path in find_miniforge_linux(ansys_manager_installed_only=True): + shutil.rmtree(path, ignore_errors=True) + def _remove_all_venvs(self): """Remove all the venv created by Ansys Python Manager.""" try: From 157a87c26a7b10102ceca48513a5114481ab5e98 Mon Sep 17 00:00:00 2001 From: Sakthi Prakash R <151930473+anssakthi@users.noreply.github.com> Date: Thu, 14 Mar 2024 18:25:06 +0530 Subject: [PATCH 02/36] Update ci_cd.yml --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index c28be133..14a63d94 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -6,7 +6,7 @@ on: tags: - "*" branches: - - main + - feature/remove-python-installations env: MAIN_PYTHON_VERSION: '3.11' From a2636c830199abea369bfd1cc3c08ea1912005e6 Mon Sep 17 00:00:00 2001 From: anssakthi Date: Fri, 15 Mar 2024 11:12:08 +0530 Subject: [PATCH 03/36] fix style --- linux/debian/installer.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/linux/debian/installer.sh b/linux/debian/installer.sh index c3210dca..6d2c735d 100644 --- a/linux/debian/installer.sh +++ b/linux/debian/installer.sh @@ -13,7 +13,7 @@ else dependencies_available=false fi # check other dependencies -arr=("wget", "gnome", "libffi-dev" "libssl-dev" "build-essential" "libsqlite3-dev" "libxcb-xinerama0") +arr=("wget" "gnome" "libffi-dev" "libssl-dev" "build-essential" "libsqlite3-dev" "libxcb-xinerama0") for x in "${arr[@]}"; do c="dpkg -s $x >/dev/null 2>&1" eval $c @@ -69,7 +69,7 @@ else dependencies_available=false fi # check other dependencies - arr=("wget", "gnome", "libffi-dev" "libssl-dev" "build-essential" "libsqlite3-dev" "libxcb-xinerama0") + arr=("wget" "gnome" "libffi-dev" "libssl-dev" "build-essential" "libsqlite3-dev" "libxcb-xinerama0") for x in "${arr[@]}"; do c="dpkg -s $x >/dev/null 2>&1" eval $c @@ -86,7 +86,13 @@ else else dpkg -x ./ansys_python_manager.deb ${HOME}/.local ./postInstallScript.sh - printf "\nInstallation success...\n" + available=$(cat ~/.bashrc | grep -zoP "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" | wc -l) + echo $available + if [ $available -lt 1 ] + then + echo -e "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" >> ~/.bashrc + fi + printf "\nInstallation successful. \nIt is suggested to restart your machine to begin using the software...." fi else echo "You don't have access to sudo. Please try again..." From 0247c26b2f71d618f90afc9376f95fc20415fdcf Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Fri, 15 Mar 2024 14:49:47 +0530 Subject: [PATCH 04/36] adding warning/note for pre-compiled python version on linux --- src/ansys/tools/installer/constants.py | 4 ++++ src/ansys/tools/installer/main.py | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ansys/tools/installer/constants.py b/src/ansys/tools/installer/constants.py index 7651eca5..0358bd93 100644 --- a/src/ansys/tools/installer/constants.py +++ b/src/ansys/tools/installer/constants.py @@ -67,6 +67,10 @@ While choosing the latest version of Python is generally recommended, some third-party libraries and applications may not yet be fully compatible with the newest release. Therefore, it is recommended to try the second newest version, as it will still have most of the latest features and improvements while also having broader support among third-party packages.""" +PRE_COMPILED_PYTHON_WARNING = """ + +NOTE - Only 'Python 3.11' version is readily available. Other python versions are compiled from source and it takes approx 2-3 minutes.""" + PYTHON_VERSION_SELECTION_FOR_VENV = """Choose the version of Python to use for your virtual environment. Please select the Python version from the table below to create its respective virtual environment.""" diff --git a/src/ansys/tools/installer/main.py b/src/ansys/tools/installer/main.py index c6d60b1e..e2f53756 100644 --- a/src/ansys/tools/installer/main.py +++ b/src/ansys/tools/installer/main.py @@ -45,6 +45,7 @@ INSTALL_TEXT, LOG, PYTHON_VERSION_TEXT, + PRE_COMPILED_PYTHON_WARNING, UNABLE_TO_RETRIEVE_LATEST_VERSION_TEXT, ) from ansys.tools.installer.create_virtual_environment import CreateVenvTab @@ -229,13 +230,21 @@ def __init__(self, show=True): self.python_version_select.addItem("Python 3.11", "3.11.6") self.python_version_select.addItem("Python 3.12", "3.12.0") - # Set the default selection to "Python 3.10" + # Set the default selection to "Python 3.11" default_index = self.python_version_select.findText("Python 3.11") self.python_version_select.setCurrentIndex(default_index) python_version_layout.addWidget(self.python_version_select) python_version_box_layout.addWidget(python_version) form_layout.addWidget(python_version_box) + + # Linux Warning/Note for Python pre-compiled version + if is_linux_os(): + python_version_warning = QtWidgets.QLabel(PRE_COMPILED_PYTHON_WARNING) + python_version_warning.setStyleSheet("color: red;") + python_version_warning.setWordWrap(True) + python_version_warning.setAlignment(QtCore.Qt.AlignmentFlag.AlignJustify) + python_version_box_layout.addWidget(python_version_warning) # ensure content does not get squished form_layout.addStretch() From e872bc0ffa27e3aeeaf1238dbbd802b5cacffc34 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Fri, 15 Mar 2024 15:10:08 +0530 Subject: [PATCH 05/36] minor --- linux/non-debian/installer_CentOS.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/non-debian/installer_CentOS.sh b/linux/non-debian/installer_CentOS.sh index 35016711..2f99812c 100644 --- a/linux/non-debian/installer_CentOS.sh +++ b/linux/non-debian/installer_CentOS.sh @@ -34,7 +34,7 @@ if [ "$user_selection" = "Y" ]; then missing_deps+=("Development Tools") dependencies_available=false fi - arr=("wget" "libffi-devel" "openssl-devel" "rpm-build" "sqlite-devel" "sqlite-libs" "libXinerama-devel") + arr=("wget" "gnome-terminal" "libffi-devel" "openssl-devel" "rpm-build" "sqlite-devel" "sqlite-libs" "libXinerama-devel") for x in "${arr[@]}"; do c="rpm -qa | grep $x" eval $c From 9b04cb8226ee77604c35b4f325b9834d41e4974c Mon Sep 17 00:00:00 2001 From: anssakthi Date: Fri, 15 Mar 2024 18:37:58 +0530 Subject: [PATCH 06/36] fix style --- linux/debian/installer.sh | 2 +- src/ansys/tools/installer/find_python.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/linux/debian/installer.sh b/linux/debian/installer.sh index 6d2c735d..be90bda2 100644 --- a/linux/debian/installer.sh +++ b/linux/debian/installer.sh @@ -92,7 +92,7 @@ else then echo -e "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" >> ~/.bashrc fi - printf "\nInstallation successful. \nIt is suggested to restart your machine to begin using the software...." + printf "\nInstallation successful. \nIt is suggested to restart your machine to begin using the software....\n" fi else echo "You don't have access to sudo. Please try again..." diff --git a/src/ansys/tools/installer/find_python.py b/src/ansys/tools/installer/find_python.py index 3031a469..ee8fca69 100644 --- a/src/ansys/tools/installer/find_python.py +++ b/src/ansys/tools/installer/find_python.py @@ -193,7 +193,7 @@ def _find_installed_python_linux(): pythons[path] = (version, admin) LOG.debug("Identified %s at %s", version, path) previous_found_version = version - except subprocess.CalledProcessError: + except: # Ignore if the command fails (e.g., if the Python version is not installed) pass From 6fdc0fef1883eaea48fa19c35731570bb3a1a17c Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Tue, 19 Mar 2024 14:54:55 +0530 Subject: [PATCH 07/36] centos & fedora specific changes --- doc/source/installer.rst | 10 ++++------ linux/non-debian/installer_CentOS.sh | 10 ++++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/doc/source/installer.rst b/doc/source/installer.rst index 28d0927e..3a97b73b 100644 --- a/doc/source/installer.rst +++ b/doc/source/installer.rst @@ -92,19 +92,18 @@ Installing the ``Ansys Python Manager`` #. **OS** supported for **CentOS9** and **RHEL9**. #. Update ``yum`` repository and install the following packages with **sudo** privileges: - **Development Tools, libffi-devel, openssl-devel, rpm-build, sqlite-devel, sqlite-libs, libXinerama-devel** + **wget, gnome-terminal, Development Tools, libffi-devel, openssl-devel, rpm-build, sqlite-devel, sqlite-libs, libXinerama-devel, coreutils** .. code:: shell sudo yum update -y; sudo yum groupinstall 'Development Tools' -y; - sudo yum install libffi-devel openssl-devel rpm-build sqlite-devel sqlite-libs libXinerama-devel -y; + sudo yum install wget gnome-terminal libffi-devel openssl-devel rpm-build sqlite-devel sqlite-libs libXinerama-devel coreutils -y; #. Install **zlib** package using **wget** .. code:: shell - sudo yum install wget -y wget https://zlib.net/current/zlib.tar.gz tar xvzf zlib.tar.gz cd zlib-* @@ -157,19 +156,18 @@ Installing the ``Ansys Python Manager`` #. **OS** supported for **Fedora39**. #. Update ``yum`` repository and install the following packages with **sudo** privileges: - **Development Tools, libffi-devel, openssl-devel, rpm-build, sqlite-devel, sqlite-libs, libXinerama-devel** + **wget, gnome-terminal, Development Tools, libffi-devel, openssl-devel, rpm-build, sqlite-devel, sqlite-libs, libXinerama-devel, coreutils** .. code:: shell sudo yum update -y; sudo yum groupinstall 'Development Tools' -y; - sudo yum install libffi-devel openssl-devel rpm-build sqlite-devel sqlite-libs libXinerama-devel -y; + sudo yum install wget gnome-terminal libffi-devel openssl-devel rpm-build sqlite-devel sqlite-libs libXinerama-devel coreutils -y; #. Install **zlib** package using **wget** .. code:: shell - sudo yum install wget -y wget https://zlib.net/current/zlib.tar.gz tar xvzf zlib.tar.gz cd zlib-* diff --git a/linux/non-debian/installer_CentOS.sh b/linux/non-debian/installer_CentOS.sh index 35016711..c7ffe194 100644 --- a/linux/non-debian/installer_CentOS.sh +++ b/linux/non-debian/installer_CentOS.sh @@ -34,7 +34,7 @@ if [ "$user_selection" = "Y" ]; then missing_deps+=("Development Tools") dependencies_available=false fi - arr=("wget" "libffi-devel" "openssl-devel" "rpm-build" "sqlite-devel" "sqlite-libs" "libXinerama-devel") + arr=("wget" "gnome-terminal" "libffi-devel" "openssl-devel" "rpm-build" "sqlite-devel" "sqlite-libs" "libXinerama-devel" "coreutils") for x in "${arr[@]}"; do c="rpm -qa | grep $x" eval $c @@ -48,7 +48,13 @@ if [ "$user_selection" = "Y" ]; then done if [ $dependencies_available = true ]; then sudo rpm -iv ansys_python_manager_*.rpm - printf "\nInstallation success...\n" + available=$(cat ~/.bashrc | grep -zoP "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" | wc -l) + echo $available + if [ $available -lt 1 ] + then + echo -e "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" | sudo tee -a ~/.bashrc + fi + printf "\nInstallation success...\nIt is suggested to restart your machine to begin using the software....\n" else echo "Missing dependencies..." install_script="sudo yum update -y; sudo yum install " From 3763adb50c0f406193375b9b19366516494d8467 Mon Sep 17 00:00:00 2001 From: anssakthi Date: Wed, 20 Mar 2024 19:22:44 +0530 Subject: [PATCH 08/36] fix style --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d8624ba5..16767b27 100644 --- a/.gitignore +++ b/.gitignore @@ -162,3 +162,4 @@ cython_debug/ #.idea/ # End of https://www.toptal.com/developers/gitignore/api/python +.vscode/settings.json From 8fc406c65a48b1a38d2329386de4ac2c70d54384 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 20 Mar 2024 14:29:42 +0000 Subject: [PATCH 09/36] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/ansys/tools/installer/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ansys/tools/installer/main.py b/src/ansys/tools/installer/main.py index e2f53756..06810637 100644 --- a/src/ansys/tools/installer/main.py +++ b/src/ansys/tools/installer/main.py @@ -44,8 +44,8 @@ ASSETS_PATH, INSTALL_TEXT, LOG, - PYTHON_VERSION_TEXT, PRE_COMPILED_PYTHON_WARNING, + PYTHON_VERSION_TEXT, UNABLE_TO_RETRIEVE_LATEST_VERSION_TEXT, ) from ansys.tools.installer.create_virtual_environment import CreateVenvTab @@ -237,7 +237,7 @@ def __init__(self, show=True): python_version_box_layout.addWidget(python_version) form_layout.addWidget(python_version_box) - + # Linux Warning/Note for Python pre-compiled version if is_linux_os(): python_version_warning = QtWidgets.QLabel(PRE_COMPILED_PYTHON_WARNING) From f0663ae2aa78c864c3dba484c1b89b2cb63a544a Mon Sep 17 00:00:00 2001 From: Sakthi Prakash R <151930473+anssakthi@users.noreply.github.com> Date: Wed, 20 Mar 2024 20:02:02 +0530 Subject: [PATCH 10/36] Update ci_cd.yml --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 14a63d94..c28be133 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -6,7 +6,7 @@ on: tags: - "*" branches: - - feature/remove-python-installations + - main env: MAIN_PYTHON_VERSION: '3.11' From 1e0989b5c25815e88014be16d07add3201524df5 Mon Sep 17 00:00:00 2001 From: anssakthi Date: Wed, 20 Mar 2024 21:23:39 +0530 Subject: [PATCH 11/36] fix style --- doc/source/installer.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/source/installer.rst b/doc/source/installer.rst index 9f2736f4..20653551 100644 --- a/doc/source/installer.rst +++ b/doc/source/installer.rst @@ -61,7 +61,7 @@ Installing the ``Ansys Python Manager`` unzip Ansys-Python-Manager_*.zip ./installer.sh - #. Restart the machine and run ``ansys_python_installer``. + #. Search for the ``Ansys Python Manager`` and run it. The ``Ansys Python Manager`` window should appear at this stage. @@ -125,7 +125,7 @@ Installing the ``Ansys Python Manager`` unzip Ansys-Python-Manager_linux_centos_*.zip ./installer_CentOS.sh - #. Restart the machine and run ``ansys_python_installer``. + #. Search for the ``Ansys Python Manager`` and run it. The ``Ansys Python Manager`` window should appear at this stage. @@ -190,7 +190,7 @@ Installing the ``Ansys Python Manager`` unzip Ansys-Python-Manager_linux_fedora_*.zip ./installer_Fedora.sh - #. Restart the machine and run ``ansys_python_installer``. + #. Search for the ``Ansys Python Manager`` and run it. The ``Ansys Python Manager`` window should appear at this stage. @@ -223,7 +223,7 @@ Now, instructions on how to install Python from the ``Ansys Python Manager`` are In order to do so, just follow the upcoming steps: -#. Launch ``Ansys Python Manager``. +#. Search for the ``Ansys Python Manager`` and run it. #. Go to the ``Install Python`` tab, and select your desired Python install, version and extra packages. @@ -289,7 +289,7 @@ Regarding the available Python versions, users can select among the following on Create Python virtual environment ================================= -#. Launch ``Ansys Python Manager``. +#. Search for the ``Ansys Python Manager`` and run it. #. Access the ``Create Python Environments`` tab. @@ -314,7 +314,7 @@ Managing Python environments Through the ``Ansys Python Manager``, users can also have access to their different Python installations. Have a look at how to access it here: -#. Launch ``Ansys Python Manager``. +#. Search for the ``Ansys Python Manager`` and run it. #. Access the ``Manage Python Environments`` tab. #. Select your desired ``Python`` environment and start one of the listed options. From 8b06509a6645fef1957ee6de7bf6cc327755c545 Mon Sep 17 00:00:00 2001 From: anssakthi Date: Thu, 21 Mar 2024 12:15:51 +0530 Subject: [PATCH 12/36] fix style --- doc/source/installer.rst | 36 +++++++++---------- doc/source/user_guide.rst | 2 +- linux/debian/installer.sh | 12 +++++-- .../assets/scripts/uninstaller_ubuntu.sh | 3 ++ src/ansys/tools/installer/constants.py | 2 +- src/ansys/tools/installer/installed_table.py | 4 +-- src/ansys/tools/installer/linux_functions.py | 8 ++--- src/ansys/tools/installer/uninstall.py | 4 +-- 8 files changed, 40 insertions(+), 31 deletions(-) diff --git a/doc/source/installer.rst b/doc/source/installer.rst index 20653551..a4979c33 100644 --- a/doc/source/installer.rst +++ b/doc/source/installer.rst @@ -71,16 +71,16 @@ Installing the ``Ansys Python Manager`` #. In the pop up window: - * If you want to remove all virtual environments which was created by - Ansys Python Manageras part of uninstallation, mark - ``Delete virtual environment`` checkbox + * If you want to remove all virtual environments which were created by + the Ansys Python Manager as part of uninstallation, mark + ``Delete virtual environments`` checkbox * If you want to remove all configurations as part of uninstallation, mark ``Delete configurations`` checkbox - * If you want to remove all python installations which was installed by - Ansys Python Manageras as part of uninstallation, mark - ``Delete python installations`` checkbox + * If you want to remove all Python installations which were installed by + the Ansys Python Manager as part of uninstallation, mark + ``Delete Python installations`` checkbox #. Click ``Uninstall`` button. @@ -135,16 +135,16 @@ Installing the ``Ansys Python Manager`` #. In the pop up window: - * If you want to remove all virtual environments which was created by - Ansys Python Manageras part of uninstallation, mark - ``Delete virtual environment`` checkbox + * If you want to remove all virtual environments which were created by + the Ansys Python Manager as part of uninstallation, mark + ``Delete virtual environments`` checkbox * If you want to remove all configurations as part of uninstallation, mark ``Delete configurations`` checkbox - * If you want to remove all python installations which was installed by - Ansys Python Manageras as part of uninstallation, mark - ``Delete python installations`` checkbox + * If you want to remove all Python installations which were installed by + the Ansys Python Manager as part of uninstallation, mark + ``Delete Python installations`` checkbox #. Click ``Uninstall`` button. @@ -200,16 +200,16 @@ Installing the ``Ansys Python Manager`` #. In the pop up window: - * If you want to remove all virtual environments which was created by - Ansys Python Manageras part of uninstallation, mark - ``Delete virtual environment`` checkbox + * If you want to remove all virtual environments which were created by + the Ansys Python Manager as part of uninstallation, mark + ``Delete virtual environments`` checkbox * If you want to remove all configurations as part of uninstallation, mark ``Delete configurations`` checkbox - * If you want to remove all python installations which was installed by - Ansys Python Manageras as part of uninstallation, mark - ``Delete python installations`` checkbox + * If you want to remove all Python installations which were installed by + the Ansys Python Manager as part of uninstallation, mark + ``Delete Python installations`` checkbox #. Click ``Uninstall`` button. diff --git a/doc/source/user_guide.rst b/doc/source/user_guide.rst index 63d64246..cf8a169f 100644 --- a/doc/source/user_guide.rst +++ b/doc/source/user_guide.rst @@ -96,7 +96,7 @@ have options available, such as deleting a virtual environment, Launch Options, General Package Management, and PyAnsys Package Management for the selected virtual environment. You can also delete a virtual environment by selecting it from the available list under “Available -virtual environments” and clicking on the “Delete virtual environment” +virtual environments” and clicking on the “Delete virtual environments” option available with context menu. .. image:: _static/manage_venv_tab.PNG diff --git a/linux/debian/installer.sh b/linux/debian/installer.sh index be90bda2..55f64bd6 100644 --- a/linux/debian/installer.sh +++ b/linux/debian/installer.sh @@ -28,7 +28,13 @@ done if [ $dependencies_available = true ]; then dpkg -x ./ansys_python_manager.deb ${HOME}/.local ./postInstallScript.sh - printf "\nInstallation success...\n" + available=$(cat ~/.bashrc | grep -zoP "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" | wc -l) + echo $available + if [ $available -lt 1 ] + then + echo -e "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" >> ~/.bashrc + fi + printf "\nInstallation successful. \nIt is suggested to restart your machine to begin using the software....\n" else echo "Missing dependencies..." while true; do @@ -86,11 +92,11 @@ else else dpkg -x ./ansys_python_manager.deb ${HOME}/.local ./postInstallScript.sh - available=$(cat ~/.bashrc | grep -zoP "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" | wc -l) + available=$(cat ~/.bashrc | grep -zoP "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" | wc -l) echo $available if [ $available -lt 1 ] then - echo -e "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" >> ~/.bashrc + echo -e "# Add alias for Ansys Python Manager \nalias ansys_python_manager=~/.local/opt/ansys_python_manager/ansys_python_manager" >> ~/.bashrc fi printf "\nInstallation successful. \nIt is suggested to restart your machine to begin using the software....\n" fi diff --git a/src/ansys/tools/installer/assets/scripts/uninstaller_ubuntu.sh b/src/ansys/tools/installer/assets/scripts/uninstaller_ubuntu.sh index 455ef974..7353955c 100755 --- a/src/ansys/tools/installer/assets/scripts/uninstaller_ubuntu.sh +++ b/src/ansys/tools/installer/assets/scripts/uninstaller_ubuntu.sh @@ -6,3 +6,6 @@ rm -rf ${HOME}/.local/share/applications/ansys_python_manager.desktop rm -rf ${HOME}/.local/usr/share/doc/ansys-python-manager rm -rf ${HOME}/.local/opt/ansys_python_manager + +sed -i '/# Add alias for Ansys Python Manager/d' ~/.bashrc +sed -i '/alias ansys_python_manager/d' ~/.bashrc \ No newline at end of file diff --git a/src/ansys/tools/installer/constants.py b/src/ansys/tools/installer/constants.py index 7d22a269..a054f07f 100644 --- a/src/ansys/tools/installer/constants.py +++ b/src/ansys/tools/installer/constants.py @@ -70,7 +70,7 @@ PRE_COMPILED_PYTHON_WARNING = """ -NOTE - Only 'Python 3.11' version is readily available. Other python versions are compiled from source and it takes approx 2-3 minutes.""" +NOTE - Only 'Python 3.11' version is readily available. Other Python versions are compiled from source and it takes approximately 2-3 minutes.""" PYTHON_VERSION_SELECTION_FOR_VENV = """Choose the version of Python to use for your virtual environment. diff --git a/src/ansys/tools/installer/installed_table.py b/src/ansys/tools/installer/installed_table.py index 5e622c26..852d1807 100644 --- a/src/ansys/tools/installer/installed_table.py +++ b/src/ansys/tools/installer/installed_table.py @@ -472,7 +472,7 @@ def find_env_type(self, table_name): return is_vanilla_python, miniforge_path, parent_path def delete_virtual_environment(self, point): - """Delete virtual environment using right click.""" + """Delete virtual environments using right click.""" # Get the cell that was right-clicked index = self.venv_table.indexAt(point) configure_json = ConfigureJson() @@ -481,7 +481,7 @@ def delete_virtual_environment(self, point): # Create the context menu menu = QtWidgets.QMenu(self) - delete_action = menu.addAction("Delete virtual environment") + delete_action = menu.addAction("Delete virtual environments") # Show the context menu and handle the user's choice action = menu.exec(self.venv_table.mapToGlobal(point)) diff --git a/src/ansys/tools/installer/linux_functions.py b/src/ansys/tools/installer/linux_functions.py index 6225ffc1..f9b62a8a 100644 --- a/src/ansys/tools/installer/linux_functions.py +++ b/src/ansys/tools/installer/linux_functions.py @@ -143,10 +143,10 @@ def find_miniforge_linux(ansys_manager_installed_only=False): """ Find miniforge installation on the host machine. - Parameters: + Parameters ---------- - ansys_manager_installed_only : Boolean(default: False) - If this value is true, then python installed via Ansys python manager will be returned. + ansys_manager_installed_only : bool, optional + If this value is True, then the Python versions installed via Ansys Python Manager will be returned. Returns ------- @@ -227,7 +227,7 @@ def create_venv_linux_conda(venv_dir, py_path): def delete_venv_conda(miniforge_path, parent_path): """ - Delete virtual environment for Miniforge. + Delete virtual environments for Miniforge. Examples -------- diff --git a/src/ansys/tools/installer/uninstall.py b/src/ansys/tools/installer/uninstall.py index 8f0eb756..f2cfa6f0 100644 --- a/src/ansys/tools/installer/uninstall.py +++ b/src/ansys/tools/installer/uninstall.py @@ -70,7 +70,7 @@ def __init__(self, parent): uninstall_window_cache_remove_venv_text = QtWidgets.QLabel() uninstall_window_cache_remove_venv_text.setText( - "Delete virtual environment " + "Delete virtual environments " ) uninstall_window_cache_remove_venv_text.setTextFormat( QtCore.Qt.TextFormat.RichText @@ -92,7 +92,7 @@ def __init__(self, parent): uninstall_window_cache_remove_python_layout = QtWidgets.QHBoxLayout() uninstall_window_cache_remove_python_text = QtWidgets.QLabel() uninstall_window_cache_remove_python_text.setText( - "Delete python installations" + "Delete Python installations" ) uninstall_window_cache_remove_python_text.setTextFormat( QtCore.Qt.TextFormat.RichText From a355f70ce5ca11a65d7398449993f91da81abd66 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Thu, 21 Mar 2024 13:03:38 +0530 Subject: [PATCH 13/36] centos/fedora uninstaller script fix --- src/ansys/tools/installer/assets/scripts/uninstaller_yum.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ansys/tools/installer/assets/scripts/uninstaller_yum.sh b/src/ansys/tools/installer/assets/scripts/uninstaller_yum.sh index a2dfd5ca..0ae132cc 100644 --- a/src/ansys/tools/installer/assets/scripts/uninstaller_yum.sh +++ b/src/ansys/tools/installer/assets/scripts/uninstaller_yum.sh @@ -1,5 +1,5 @@ while true; do - read -p "Require sudo permission to uninstall this package and the dependencies. Do you want to continue?(Y/N): " user_selection + read -p "Require sudo permission to uninstall this package. Do you want to continue?(Y/N): " user_selection if [ "$user_selection" = "Y" ] || [ "$user_selection" = "N" ]; then break fi @@ -14,6 +14,8 @@ if [ "$user_selection" = "Y" ]; then echo "Uninstalling Ansys Python Manager......." sleep 2 sudo yum remove -y ansys_python_manager.x86_64 + sudo sed -i '/# Add alias for Ansys Python Manager/d' ~/.bashrc + sudo sed -i '/alias ansys_python_manager/d' ~/.bashrc printf "\nUninstalled successfully...\n" else echo "You don't have access to sudo. Please try again..." @@ -21,5 +23,5 @@ if [ "$user_selection" = "Y" ]; then else # Script aborted by user printf "Aborting....\nUser permission denied.... \n\n" - echo "Ansys Python Manager and required dependencies require sudo access to uninstall." + echo "Ansys Python Manager package requires sudo access to uninstall." fi \ No newline at end of file From 3156b7204d78d5c60e7aed682cf5bd256756a468 Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Thu, 21 Mar 2024 17:00:46 +0530 Subject: [PATCH 14/36] fix style --- src/ansys/tools/installer/constants.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ansys/tools/installer/constants.py b/src/ansys/tools/installer/constants.py index a054f07f..64385d6a 100644 --- a/src/ansys/tools/installer/constants.py +++ b/src/ansys/tools/installer/constants.py @@ -69,8 +69,7 @@ While choosing the latest version of Python is generally recommended, some third-party libraries and applications may not yet be fully compatible with the newest release. Therefore, it is recommended to try the second newest version, as it will still have most of the latest features and improvements while also having broader support among third-party packages.""" PRE_COMPILED_PYTHON_WARNING = """ - -NOTE - Only 'Python 3.11' version is readily available. Other Python versions are compiled from source and it takes approximately 2-3 minutes.""" +NOTE- Only 'Python 3.11' version is readily available. Other Python versions are compiled from source and it takes approximately 2-3 minutes.""" PYTHON_VERSION_SELECTION_FOR_VENV = """Choose the version of Python to use for your virtual environment. From 85f4a84ef9c3d7645e7c2286fe17b37a62fb3dfd Mon Sep 17 00:00:00 2001 From: Tushar Bana Date: Thu, 21 Mar 2024 17:05:01 +0530 Subject: [PATCH 15/36] fix style --- src/ansys/tools/installer/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/tools/installer/constants.py b/src/ansys/tools/installer/constants.py index 64385d6a..be5565fe 100644 --- a/src/ansys/tools/installer/constants.py +++ b/src/ansys/tools/installer/constants.py @@ -69,7 +69,7 @@ While choosing the latest version of Python is generally recommended, some third-party libraries and applications may not yet be fully compatible with the newest release. Therefore, it is recommended to try the second newest version, as it will still have most of the latest features and improvements while also having broader support among third-party packages.""" PRE_COMPILED_PYTHON_WARNING = """ -NOTE- Only 'Python 3.11' version is readily available. Other Python versions are compiled from source and it takes approximately 2-3 minutes.""" +NOTE: Only 'Python 3.11' version is readily available. Other Python versions are compiled from source and it takes approximately 2-3 minutes.""" PYTHON_VERSION_SELECTION_FOR_VENV = """Choose the version of Python to use for your virtual environment. From 70f7426efb1e8b012401d0c24f158057d3e02f91 Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Wed, 27 Mar 2024 11:57:11 +0100 Subject: [PATCH 16/36] Update src/ansys/tools/installer/installed_table.py --- src/ansys/tools/installer/installed_table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/tools/installer/installed_table.py b/src/ansys/tools/installer/installed_table.py index 852d1807..1565cd65 100644 --- a/src/ansys/tools/installer/installed_table.py +++ b/src/ansys/tools/installer/installed_table.py @@ -481,7 +481,7 @@ def delete_virtual_environment(self, point): # Create the context menu menu = QtWidgets.QMenu(self) - delete_action = menu.addAction("Delete virtual environments") + delete_action = menu.addAction("Delete virtual environment") # Show the context menu and handle the user's choice action = menu.exec(self.venv_table.mapToGlobal(point)) From 4b8eb068968d99e8cbf6977ce9107735af78680e Mon Sep 17 00:00:00 2001 From: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Date: Wed, 27 Mar 2024 11:58:44 +0100 Subject: [PATCH 17/36] Update src/ansys/tools/installer/main.py --- src/ansys/tools/installer/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ansys/tools/installer/main.py b/src/ansys/tools/installer/main.py index 06810637..ce5b9ff4 100644 --- a/src/ansys/tools/installer/main.py +++ b/src/ansys/tools/installer/main.py @@ -241,7 +241,6 @@ def __init__(self, show=True): # Linux Warning/Note for Python pre-compiled version if is_linux_os(): python_version_warning = QtWidgets.QLabel(PRE_COMPILED_PYTHON_WARNING) - python_version_warning.setStyleSheet("color: red;") python_version_warning.setWordWrap(True) python_version_warning.setAlignment(QtCore.Qt.AlignmentFlag.AlignJustify) python_version_box_layout.addWidget(python_version_warning) From 5a6f3b7ca7f1bd65bc53a2963cd221933ee532dd Mon Sep 17 00:00:00 2001 From: anssakthi Date: Thu, 28 Mar 2024 17:18:01 +0530 Subject: [PATCH 18/36] fix style --- src/ansys/tools/installer/installed_table.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ansys/tools/installer/installed_table.py b/src/ansys/tools/installer/installed_table.py index 1565cd65..509cbeed 100644 --- a/src/ansys/tools/installer/installed_table.py +++ b/src/ansys/tools/installer/installed_table.py @@ -251,6 +251,10 @@ def __init__(self, parent=None): self.button_launch_cmd.clicked.connect(self.launch_cmd) hbox.addWidget(self.button_launch_cmd) + self.button_launch_cmd = QtWidgets.QPushButton("Launch VSCode") + self.button_launch_cmd.clicked.connect(self.launch_vscode) + hbox.addWidget(self.button_launch_cmd) + self.button_launch_lab = QtWidgets.QPushButton("Launch Jupyterlab") self.button_launch_lab.clicked.connect(self.launch_jupyterlab) hbox.addWidget(self.button_launch_lab) @@ -365,6 +369,12 @@ def launch_jupyterlab(self): self._update_pck_mnger() self.launch_cmd(f"python -m jupyter lab || {error_msg}") + def launch_vscode(self): + """Launch VSCode.""" + # handle errors + error_msg = "echo Failed to launch vscode. Try reinstalling code by following this link https://code.visualstudio.com/download" + self.launch_cmd(f"code . || {error_msg}") + def launch_jupyter_notebook(self): """Launch Jupyter Notebook.""" # handle errors From f57a2f4d46de1a808d71dbf03a340d03d31b7dca Mon Sep 17 00:00:00 2001 From: Sakthi Prakash R <151930473+anssakthi@users.noreply.github.com> Date: Thu, 28 Mar 2024 19:00:01 +0530 Subject: [PATCH 19/36] Update ci_cd.yml --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index c28be133..0838d502 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -6,7 +6,7 @@ on: tags: - "*" branches: - - main + - vcode-enablement env: MAIN_PYTHON_VERSION: '3.11' From 3ec3089d87408a3f538ed1d1b469d7e6de580dc2 Mon Sep 17 00:00:00 2001 From: anssakthi Date: Mon, 1 Apr 2024 14:14:59 +0530 Subject: [PATCH 20/36] fix style --- src/ansys/tools/installer/installed_table.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ansys/tools/installer/installed_table.py b/src/ansys/tools/installer/installed_table.py index 509cbeed..799e36cb 100644 --- a/src/ansys/tools/installer/installed_table.py +++ b/src/ansys/tools/installer/installed_table.py @@ -46,6 +46,7 @@ run_linux_command, run_linux_command_conda, ) +from ansys.tools.installer.vscode import VSCode ALLOWED_FOCUS_EVENTS = [QtCore.QEvent.Type.WindowActivate, QtCore.QEvent.Type.Show] LOG = logging.getLogger(__name__) @@ -371,9 +372,7 @@ def launch_jupyterlab(self): def launch_vscode(self): """Launch VSCode.""" - # handle errors - error_msg = "echo Failed to launch vscode. Try reinstalling code by following this link https://code.visualstudio.com/download" - self.launch_cmd(f"code . || {error_msg}") + vscode = VSCode(self) def launch_jupyter_notebook(self): """Launch Jupyter Notebook.""" From 6298a115a06d7334e395c288523685aea862bf7b Mon Sep 17 00:00:00 2001 From: anssakthi Date: Mon, 1 Apr 2024 14:37:37 +0530 Subject: [PATCH 21/36] fix style --- src/ansys/tools/installer/configure.py | 7 +++++-- src/ansys/tools/installer/uninstall.py | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ansys/tools/installer/configure.py b/src/ansys/tools/installer/configure.py index d6404b58..a0d4779d 100644 --- a/src/ansys/tools/installer/configure.py +++ b/src/ansys/tools/installer/configure.py @@ -35,13 +35,14 @@ class Configure(QtWidgets.QWidget): - """Manage Virtual Environment w.r.t Python versions tab.""" + """Configure tab tab.""" def __init__(self, parent): - """Initialize this tab.""" + """Initialize this class.""" try: super().__init__() self._parent = parent + self._parent.setEnabled(False) self.configure_json = ConfigureJson() self._parent.configure_window = QtWidgets.QWidget() self._parent.configure_window.move( @@ -250,11 +251,13 @@ def _save_configuration(self): self.user_confirmation_form.close() self._parent.configure_window.close() + self._parent.setEnabled(True) def _close_all(self): """Close all the pop-up window.""" self.user_confirmation_form.close() self._parent.configure_window.close() + self._parent.setEnabled(True) def _pop_up(self, message, call_back): """Launch the confirmation pop-up window.""" diff --git a/src/ansys/tools/installer/uninstall.py b/src/ansys/tools/installer/uninstall.py index f2cfa6f0..29f5d883 100644 --- a/src/ansys/tools/installer/uninstall.py +++ b/src/ansys/tools/installer/uninstall.py @@ -45,6 +45,7 @@ def __init__(self, parent): try: super().__init__() self._parent = parent + self._parent.setEnabled(False) self._parent.uninstall_window = QtWidgets.QWidget() self._parent.uninstall_window.move( self._parent.uninstall_window.frameGeometry().center() @@ -200,6 +201,7 @@ def _uninstall(self): self.user_confirmation_form.close() self._parent.uninstall_window.close() self._parent.close_emit() + self._parent.setEnabled(True) def _remove_all_installed_python(self): for path in find_ansys_installed_python_linux(): @@ -245,6 +247,7 @@ def _close_all(self): """Close all the pop-up window.""" self.user_confirmation_form.close() self._parent.uninstall_window.close() + self._parent.setEnabled(True) def _pop_up(self, message, call_back): """Launch the confirmation pop-up window.""" From 26c8f83b8889c852ae8acb3325608b84d5dbaaa8 Mon Sep 17 00:00:00 2001 From: anssakthi Date: Mon, 1 Apr 2024 14:38:11 +0530 Subject: [PATCH 22/36] fix style --- src/ansys/tools/installer/vscode.py | 173 ++++++++++++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 src/ansys/tools/installer/vscode.py diff --git a/src/ansys/tools/installer/vscode.py b/src/ansys/tools/installer/vscode.py new file mode 100644 index 00000000..45bfa5b7 --- /dev/null +++ b/src/ansys/tools/installer/vscode.py @@ -0,0 +1,173 @@ +# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +"""VS code launch window.""" +import os + +from PySide6 import QtCore, QtGui, QtWidgets + +from ansys.tools.installer.constants import ANSYS_FAVICON, USER_PATH + + +class VSCode(QtWidgets.QWidget): + """VS code launch window.""" + + def __init__(self, parent): + """Initialize this class.""" + try: + super().__init__() + self._parent = parent + self._parent.setEnabled(False) + if self.is_vscode_installed(): + self._parent.vscode_window = QtWidgets.QWidget() + self._parent.vscode_window.move( + self._parent.vscode_window.frameGeometry().center() + ) + vscode_window_label = QtWidgets.QLabel() + vscode_window_label.setText("Configuration") + vscode_window_label.setTextFormat(QtCore.Qt.TextFormat.RichText) + vscode_window_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignJustify) + vscode_window_label.setWordWrap(True) + + vscode_layout = QtWidgets.QVBoxLayout() + + # Group 1: Configure default Virtual Environment creation path + vscode_window_path_config = QtWidgets.QGroupBox( + "VS Code open directory:" + ) + vscode_window_path_config_layout = QtWidgets.QVBoxLayout() + vscode_window_path_config_layout.setContentsMargins(10, 20, 10, 20) + vscode_window_path_config.setLayout(vscode_window_path_config_layout) + + # ---> Add box + self.vscode_window_path_config_edit = QtWidgets.QLineEdit() + self.vscode_window_path_config_edit.setText(USER_PATH) + vscode_window_path_config_layout.addWidget( + self.vscode_window_path_config_edit + ) + + # Finally, add all the previous widgets to the global layout + vscode_layout.addWidget(vscode_window_path_config) + + vscode_window_button_open = QtWidgets.QPushButton("Open") + vscode_window_button_open.clicked.connect( + lambda x: self._pop_up("Do you want to open?", self._open_vscode) + ) + vscode_window_button_close = QtWidgets.QPushButton("Close") + vscode_window_button_close.clicked.connect( + lambda x: self._pop_up("Do you want to close?", self._close_all) + ) + + vscode_window_layout_1 = QtWidgets.QHBoxLayout() + vscode_window_layout_1.addWidget(vscode_window_label) + vscode_window_layout_2 = QtWidgets.QHBoxLayout() + vscode_window_layout_2.addWidget(vscode_window_button_open) + vscode_window_layout_2.addWidget(vscode_window_button_close) + + vscode_window_layout = QtWidgets.QVBoxLayout() + vscode_window_layout.addLayout(vscode_window_layout_1) + vscode_window_layout.addLayout(vscode_layout) + vscode_window_layout.addLayout(vscode_window_layout_2) + self._parent.vscode_window.setLayout(vscode_window_layout) + + self._parent.vscode_window.setWindowTitle("Configuration") + self._parent.vscode_window.setWindowIcon(QtGui.QIcon(ANSYS_FAVICON)) + self._parent.vscode_window.setWindowFlag( + QtCore.Qt.WindowCloseButtonHint, False + ) + self._parent.vscode_window.resize(500, 40) + self._parent.vscode_window.show() + else: + msg = QtWidgets.QMessageBox() + msg.setTextFormat(QtCore.Qt.TextFormat.RichText) + msg.warning( + self, + "VS Code Launch Error", + f"Failed to launch vscode. Try reinstalling code by following this link", + ) + self._parent.setEnabled(True) + + except Exception as e: + self._parent.show_error(str(e)) + + def _open_vscode(self): + """Open VS code from path.""" + # handle errors + error_msg = "echo Failed to launch vscode. Try reinstalling code by following this link https://code.visualstudio.com/download" + self._parent.launch_cmd( + f"code {self.vscode_window_path_config_edit.text()} || {error_msg}" + ) + + self.user_confirmation_form.close() + self._parent.vscode_window.close() + self._parent.setEnabled(True) + + def _close_all(self): + """Close all the pop-up window.""" + self.user_confirmation_form.close() + self._parent.vscode_window.close() + self._parent.setEnabled(True) + + def _pop_up(self, message, call_back): + """Launch the confirmation pop-up window.""" + self.user_confirmation_form = QtWidgets.QWidget() + self.user_confirmation_form.move( + self.user_confirmation_form.frameGeometry().center() + ) + user_confirmation_label = QtWidgets.QLabel() + user_confirmation_label.setText(message) + user_confirmation_label.setOpenExternalLinks(True) + user_confirmation_label.setTextFormat(QtCore.Qt.TextFormat.RichText) + user_confirmation_label.setAlignment(QtCore.Qt.AlignmentFlag.AlignJustify) + user_confirmation_label.setWordWrap(True) + + user_confirmation_layout_horizontal = QtWidgets.QHBoxLayout() + user_confirmation_yes_button = QtWidgets.QPushButton("Yes") + user_confirmation_yes_button.clicked.connect(call_back) + user_confirmation_no_button = QtWidgets.QPushButton("No") + user_confirmation_no_button.clicked.connect(self.user_confirmation_form.close) + user_confirmation_layout = QtWidgets.QVBoxLayout() + user_confirmation_layout.addWidget(user_confirmation_label) + user_confirmation_layout_horizontal.addWidget(user_confirmation_yes_button) + user_confirmation_layout_horizontal.addWidget(user_confirmation_no_button) + user_confirmation_layout.addLayout(user_confirmation_layout_horizontal) + self.user_confirmation_form.setLayout(user_confirmation_layout) + self.user_confirmation_form.setWindowTitle("Confirmation") + icon = QtGui.QIcon(ANSYS_FAVICON) + self.user_confirmation_form.setWindowIcon(icon) + self.user_confirmation_form.resize(400, 40) + self.user_confirmation_form.setWindowFlag( + QtCore.Qt.WindowCloseButtonHint, False + ) + self.user_confirmation_form.show() + + def is_vscode_installed(self): + """Check vs code installed or Not. + + Returns: + Boolean + """ + try: + os.system("code --version") + return True + except: + return False From c75f8b791345ee66745220b94a919a9ef88ff679 Mon Sep 17 00:00:00 2001 From: anssakthi Date: Mon, 1 Apr 2024 15:42:00 +0530 Subject: [PATCH 23/36] fix style --- src/ansys/tools/installer/vscode.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ansys/tools/installer/vscode.py b/src/ansys/tools/installer/vscode.py index 45bfa5b7..ff58821a 100644 --- a/src/ansys/tools/installer/vscode.py +++ b/src/ansys/tools/installer/vscode.py @@ -167,7 +167,10 @@ def is_vscode_installed(self): Boolean """ try: - os.system("code --version") - return True + return_val = os.system("code --version") + if return_val == 0: + return True + else: + return False except: return False From 92a7c2fb61d4c82e6f2570439a2f20e37949aa98 Mon Sep 17 00:00:00 2001 From: anssakthi Date: Tue, 2 Apr 2024 15:58:03 +0530 Subject: [PATCH 24/36] fix style --- setup.nsi | 14 +++++++++++++- src/ansys/tools/installer/vscode.py | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/setup.nsi b/setup.nsi index 0fb72130..a75fe4aa 100644 --- a/setup.nsi +++ b/setup.nsi @@ -22,9 +22,19 @@ OutFile "dist\${OUTFILE_NAME}" !insertmacro MULTIUSER_PAGE_INSTALLMODE !insertmacro MUI_PAGE_LICENSE "${LICENSE_FILE}" !insertmacro MUI_PAGE_INSTFILES -!insertmacro MUI_LANGUAGE English !include "uninstall.nsi" +Function CreateDesktopShortCut + CreateShortCut "$desktop\Ansys Python Manager.lnk" "$INSTDIR\Ansys Python Manager.exe" +FunctionEnd + +!define MUI_FINISHPAGE_RUN "$INSTDIR\Ansys Python Manager.exe" +!define MUI_FINISHPAGE_SHOWREADME +!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut" +!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED +!define MUI_FINISHPAGE_SHOWREADME_FUNCTION "CreateDesktopShortCut" +!insertmacro MUI_PAGE_FINISH + Function .onInit !insertmacro MULTIUSER_INIT FunctionEnd @@ -74,6 +84,7 @@ Section "Uninstall" SEC02 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" Delete "$SMPROGRAMS\Ansys Python Manager\Ansys Python Manager.lnk" RMDir "$SMPROGRAMS\Ansys Python Manager" + Delete "$desktop\Ansys Python Manager.lnk" SectionEnd Icon "dist\ansys_python_manager\_internal\assets\pyansys_icon.ico" @@ -90,3 +101,4 @@ FunctionEnd ; Call the MUI2 OneClick plugin !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_LANGUAGE English diff --git a/src/ansys/tools/installer/vscode.py b/src/ansys/tools/installer/vscode.py index ff58821a..48b2231d 100644 --- a/src/ansys/tools/installer/vscode.py +++ b/src/ansys/tools/installer/vscode.py @@ -114,7 +114,7 @@ def _open_vscode(self): # handle errors error_msg = "echo Failed to launch vscode. Try reinstalling code by following this link https://code.visualstudio.com/download" self._parent.launch_cmd( - f"code {self.vscode_window_path_config_edit.text()} || {error_msg}" + f"code {self.vscode_window_path_config_edit.text().strip()} || {error_msg}" ) self.user_confirmation_form.close() From 11c41317435336975d2cd75f24e374f54771fb76 Mon Sep 17 00:00:00 2001 From: anssakthi Date: Tue, 2 Apr 2024 16:52:39 +0530 Subject: [PATCH 25/36] fix style --- src/ansys/tools/installer/uninstall.py | 5 +--- src/ansys/tools/installer/vscode.py | 38 ++++++++++++++++---------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/ansys/tools/installer/uninstall.py b/src/ansys/tools/installer/uninstall.py index d1426912..6c639918 100644 --- a/src/ansys/tools/installer/uninstall.py +++ b/src/ansys/tools/installer/uninstall.py @@ -45,7 +45,6 @@ def __init__(self, parent): try: super().__init__() self._parent = parent - self._parent.setEnabled(False) self._parent.uninstall_window = QtWidgets.QWidget() self._parent.uninstall_window.move( self._parent.uninstall_window.frameGeometry().center() @@ -171,7 +170,7 @@ def __init__(self, parent): self._parent.uninstall_window.setWindowTitle("Uninstall") self._parent.uninstall_window.setWindowIcon(QtGui.QIcon(ANSYS_FAVICON)) self._parent.uninstall_window.setWindowFlag( - QtCore.Qt.WindowCloseButtonHint, False + QtCore.Qt.WindowCloseButtonHint, True ) self._parent.uninstall_window.resize(500, 40) self._parent.uninstall_window.show() @@ -201,7 +200,6 @@ def _uninstall(self): self.user_confirmation_form.close() self._parent.uninstall_window.close() self._parent.close_emit() - self._parent.setEnabled(True) def _remove_all_installed_python(self): for path in find_ansys_installed_python_linux(): @@ -254,7 +252,6 @@ def _close_all(self): """Close all the pop-up window.""" self.user_confirmation_form.close() self._parent.uninstall_window.close() - self._parent.setEnabled(True) def _pop_up(self, message, call_back): """Launch the confirmation pop-up window.""" diff --git a/src/ansys/tools/installer/vscode.py b/src/ansys/tools/installer/vscode.py index 48b2231d..278cf70f 100644 --- a/src/ansys/tools/installer/vscode.py +++ b/src/ansys/tools/installer/vscode.py @@ -36,7 +36,6 @@ def __init__(self, parent): try: super().__init__() self._parent = parent - self._parent.setEnabled(False) if self.is_vscode_installed(): self._parent.vscode_window = QtWidgets.QWidget() self._parent.vscode_window.move( @@ -65,6 +64,13 @@ def __init__(self, parent): self.vscode_window_path_config_edit ) + self.vscode_warning_text = QtWidgets.QLabel() + self.vscode_warning_text.setAlignment( + QtCore.Qt.AlignmentFlag.AlignJustify + ) + self.vscode_warning_text.setWordWrap(True) + vscode_window_path_config_layout.addWidget(self.vscode_warning_text) + # Finally, add all the previous widgets to the global layout vscode_layout.addWidget(vscode_window_path_config) @@ -91,9 +97,6 @@ def __init__(self, parent): self._parent.vscode_window.setWindowTitle("Configuration") self._parent.vscode_window.setWindowIcon(QtGui.QIcon(ANSYS_FAVICON)) - self._parent.vscode_window.setWindowFlag( - QtCore.Qt.WindowCloseButtonHint, False - ) self._parent.vscode_window.resize(500, 40) self._parent.vscode_window.show() else: @@ -104,7 +107,6 @@ def __init__(self, parent): "VS Code Launch Error", f"Failed to launch vscode. Try reinstalling code by following this link", ) - self._parent.setEnabled(True) except Exception as e: self._parent.show_error(str(e)) @@ -112,20 +114,28 @@ def __init__(self, parent): def _open_vscode(self): """Open VS code from path.""" # handle errors - error_msg = "echo Failed to launch vscode. Try reinstalling code by following this link https://code.visualstudio.com/download" - self._parent.launch_cmd( - f"code {self.vscode_window_path_config_edit.text().strip()} || {error_msg}" - ) - - self.user_confirmation_form.close() - self._parent.vscode_window.close() - self._parent.setEnabled(True) + path = self.vscode_window_path_config_edit.text().strip() + if os.path.exists(path): + error_msg = "echo Failed to launch vscode. Try reinstalling code by following this link https://code.visualstudio.com/download" + self._parent.launch_cmd(f"code {path} && exit 0 || {error_msg}") + + self.user_confirmation_form.close() + self._parent.vscode_window.close() + else: + self.vscode_warning_text.setText( + f"""{path} does not exist. Provide a valid path.""" + ) + self.vscode_warning_text.setStyleSheet( + """ + color: rgb(255, 0, 0); + """ + ) + self.user_confirmation_form.close() def _close_all(self): """Close all the pop-up window.""" self.user_confirmation_form.close() self._parent.vscode_window.close() - self._parent.setEnabled(True) def _pop_up(self, message, call_back): """Launch the confirmation pop-up window.""" From 0c35e2a17e1e91c5da49e9e2136885c72d41fc26 Mon Sep 17 00:00:00 2001 From: anssakthi Date: Tue, 2 Apr 2024 16:56:09 +0530 Subject: [PATCH 26/36] fix style --- src/ansys/tools/installer/configure.py | 3 --- src/ansys/tools/installer/uninstall.py | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ansys/tools/installer/configure.py b/src/ansys/tools/installer/configure.py index a0d4779d..de530027 100644 --- a/src/ansys/tools/installer/configure.py +++ b/src/ansys/tools/installer/configure.py @@ -42,7 +42,6 @@ def __init__(self, parent): try: super().__init__() self._parent = parent - self._parent.setEnabled(False) self.configure_json = ConfigureJson() self._parent.configure_window = QtWidgets.QWidget() self._parent.configure_window.move( @@ -251,13 +250,11 @@ def _save_configuration(self): self.user_confirmation_form.close() self._parent.configure_window.close() - self._parent.setEnabled(True) def _close_all(self): """Close all the pop-up window.""" self.user_confirmation_form.close() self._parent.configure_window.close() - self._parent.setEnabled(True) def _pop_up(self, message, call_back): """Launch the confirmation pop-up window.""" diff --git a/src/ansys/tools/installer/uninstall.py b/src/ansys/tools/installer/uninstall.py index 6c639918..65ff0a01 100644 --- a/src/ansys/tools/installer/uninstall.py +++ b/src/ansys/tools/installer/uninstall.py @@ -170,7 +170,7 @@ def __init__(self, parent): self._parent.uninstall_window.setWindowTitle("Uninstall") self._parent.uninstall_window.setWindowIcon(QtGui.QIcon(ANSYS_FAVICON)) self._parent.uninstall_window.setWindowFlag( - QtCore.Qt.WindowCloseButtonHint, True + QtCore.Qt.WindowCloseButtonHint, False ) self._parent.uninstall_window.resize(500, 40) self._parent.uninstall_window.show() From 7a492e8448f8afb82ab9bfb7d9d53ff5332ca41e Mon Sep 17 00:00:00 2001 From: anssakthi Date: Mon, 8 Apr 2024 14:12:00 +0530 Subject: [PATCH 27/36] fix style --- doc/source/installer.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/source/installer.rst b/doc/source/installer.rst index a4979c33..6c70affa 100644 --- a/doc/source/installer.rst +++ b/doc/source/installer.rst @@ -334,8 +334,10 @@ On the ``Launching options`` section, the following options are available: * ``Launch Console``: this option starts a console window with the command ``python`` pointing towards your selected Python environment. -* ``Launch JupyterLab``: this option starts a ``JupyterLab`` session. If ``JupyterLab`` is +* ``Launch VSCode``: this option starts a ``Visual Studio Code``. If ``Visual Studio Code`` is not installed, then the ``Ansys Python Manager`` installs it for you. +* ``Launch JupyterLab``: this option starts a ``JupyterLab`` session. If ``JupyterLab`` is + not installed, then the ``Ansys Python Manager`` provides instructions to install it. * ``Launch Jupyter Notebook``: this option starts a ``Jupyter Notebook`` session. If ``Jupyter Notebook`` is not installed, then the ``Ansys Python Manager`` installs it for you. * ``Launch Spyder``: this option starts a Spyder IDE session. If Spyder is not installed, From 6aa8c261d09bd0b0c3d38097139d7f572000871b Mon Sep 17 00:00:00 2001 From: Sakthi Prakash R <151930473+anssakthi@users.noreply.github.com> Date: Mon, 8 Apr 2024 16:12:58 +0530 Subject: [PATCH 28/36] Update ci_cd.yml --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 0838d502..c28be133 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -6,7 +6,7 @@ on: tags: - "*" branches: - - vcode-enablement + - main env: MAIN_PYTHON_VERSION: '3.11' From 63f291663959724f43486ce06b70e0bae41e6343 Mon Sep 17 00:00:00 2001 From: Sakthi Prakash R <151930473+anssakthi@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:42:25 +0530 Subject: [PATCH 29/36] Update ci_cd.yml --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index c28be133..bdfa809d 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -6,7 +6,7 @@ on: tags: - "*" branches: - - main + - "*" env: MAIN_PYTHON_VERSION: '3.11' From 4bba9c28205debacdce62de74bea785005e48156 Mon Sep 17 00:00:00 2001 From: Sakthi Prakash R <151930473+anssakthi@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:07:39 +0530 Subject: [PATCH 30/36] Update src/ansys/tools/installer/vscode.py Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- src/ansys/tools/installer/vscode.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ansys/tools/installer/vscode.py b/src/ansys/tools/installer/vscode.py index 278cf70f..2016fe9f 100644 --- a/src/ansys/tools/installer/vscode.py +++ b/src/ansys/tools/installer/vscode.py @@ -173,8 +173,10 @@ def _pop_up(self, message, call_back): def is_vscode_installed(self): """Check vs code installed or Not. - Returns: - Boolean + Returns + ------- + bool + Whether VSCode is installed or not. """ try: return_val = os.system("code --version") From b28d15bfb48ebf99876ff6f90333d6d82b2fbf10 Mon Sep 17 00:00:00 2001 From: Sakthi Prakash R <151930473+anssakthi@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:08:01 +0530 Subject: [PATCH 31/36] Update doc/source/installer.rst Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- doc/source/installer.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/source/installer.rst b/doc/source/installer.rst index 6c70affa..a39ce58e 100644 --- a/doc/source/installer.rst +++ b/doc/source/installer.rst @@ -335,9 +335,9 @@ On the ``Launching options`` section, the following options are available: * ``Launch Console``: this option starts a console window with the command ``python`` pointing towards your selected Python environment. * ``Launch VSCode``: this option starts a ``Visual Studio Code``. If ``Visual Studio Code`` is - not installed, then the ``Ansys Python Manager`` installs it for you. -* ``Launch JupyterLab``: this option starts a ``JupyterLab`` session. If ``JupyterLab`` is not installed, then the ``Ansys Python Manager`` provides instructions to install it. +* ``Launch JupyterLab``: this option starts a ``JupyterLab`` session. If ``JupyterLab`` is + not installed, then the ``Ansys Python Manager`` installs it for you. * ``Launch Jupyter Notebook``: this option starts a ``Jupyter Notebook`` session. If ``Jupyter Notebook`` is not installed, then the ``Ansys Python Manager`` installs it for you. * ``Launch Spyder``: this option starts a Spyder IDE session. If Spyder is not installed, From 85f0ebbb631baa804081ceeed5b23fde8bccbd7d Mon Sep 17 00:00:00 2001 From: Sakthi Prakash R <151930473+anssakthi@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:14:19 +0530 Subject: [PATCH 32/36] Apply suggestions from code review Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- src/ansys/tools/installer/vscode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/tools/installer/vscode.py b/src/ansys/tools/installer/vscode.py index 2016fe9f..91693ea3 100644 --- a/src/ansys/tools/installer/vscode.py +++ b/src/ansys/tools/installer/vscode.py @@ -171,7 +171,7 @@ def _pop_up(self, message, call_back): self.user_confirmation_form.show() def is_vscode_installed(self): - """Check vs code installed or Not. + """Check if VSCode is installed or not. Returns ------- From f7b5228a00a18cbaa7a5fc4eadf4d13ee67d5cc8 Mon Sep 17 00:00:00 2001 From: Sakthi Prakash R <151930473+anssakthi@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:16:03 +0530 Subject: [PATCH 33/36] wip --- src/ansys/tools/installer/configure.py | 2 +- src/ansys/tools/installer/uninstall.py | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/ansys/tools/installer/configure.py b/src/ansys/tools/installer/configure.py index de530027..1f614cc1 100644 --- a/src/ansys/tools/installer/configure.py +++ b/src/ansys/tools/installer/configure.py @@ -35,7 +35,7 @@ class Configure(QtWidgets.QWidget): - """Configure tab tab.""" + """Configure tab.""" def __init__(self, parent): """Initialize this class.""" diff --git a/src/ansys/tools/installer/uninstall.py b/src/ansys/tools/installer/uninstall.py index 65ff0a01..f2cfa6f0 100644 --- a/src/ansys/tools/installer/uninstall.py +++ b/src/ansys/tools/installer/uninstall.py @@ -208,13 +208,6 @@ def _remove_all_installed_python(self): for path in find_miniforge_linux(ansys_manager_installed_only=True): shutil.rmtree(path, ignore_errors=True) - def _remove_all_installed_python(self): - for path in find_ansys_installed_python_linux(): - path = path.split("bin")[0] - shutil.rmtree(path, ignore_errors=True) - for path in find_miniforge_linux(ansys_manager_installed_only=True): - shutil.rmtree(path, ignore_errors=True) - def _remove_all_venvs(self): """Remove all the venv created by Ansys Python Manager.""" try: From 591159909e942335962289cf98aaa752993739c6 Mon Sep 17 00:00:00 2001 From: Sakthi Prakash R <151930473+anssakthi@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:46:54 +0530 Subject: [PATCH 34/36] wip --- setup.nsi | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/setup.nsi b/setup.nsi index a75fe4aa..b0e406b5 100644 --- a/setup.nsi +++ b/setup.nsi @@ -67,13 +67,7 @@ Section "Ansys Python Manager" SEC01 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${PRODUCT_VERSION}" WriteUninstaller "$INSTDIR\uninstall.exe" - - ; start after install - Exec "$INSTDIR\Ansys Python Manager.exe" - - ; After installation succeeded, wait and close - Sleep 5000 - Quit + SectionEnd ; Define the uninstaller section From 3cb8a1dfe5ea540dea3eb3a52db78f07e1c07256 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:17:07 +0000 Subject: [PATCH 35/36] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- setup.nsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.nsi b/setup.nsi index b0e406b5..add5b638 100644 --- a/setup.nsi +++ b/setup.nsi @@ -67,7 +67,7 @@ Section "Ansys Python Manager" SEC01 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${PRODUCT_VERSION}" WriteUninstaller "$INSTDIR\uninstall.exe" - + SectionEnd ; Define the uninstaller section From de72230be044cc3cb9647f1a995b17de13e5795e Mon Sep 17 00:00:00 2001 From: Sakthi Prakash R <151930473+anssakthi@users.noreply.github.com> Date: Mon, 15 Apr 2024 14:10:47 +0530 Subject: [PATCH 36/36] wip --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index bdfa809d..c28be133 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -6,7 +6,7 @@ on: tags: - "*" branches: - - "*" + - main env: MAIN_PYTHON_VERSION: '3.11'