Skip to content

Commit

Permalink
[Utils] Installer: Fix checking of shell paths (WasmEdge#2752)
Browse files Browse the repository at this point in the history
* [Utils] Installer CI: Add linting check using black formatter for python

Signed-off-by: Shreyas Atre <[email protected]>

* [Utils] Installer: Check if variable is None

- Ref: WasmEdge#2749

Signed-off-by: Shreyas Atre <[email protected]>

* [Utils] Installer CI: Revert wrong rebase change

Signed-off-by: satacker <[email protected]>
Signed-off-by: Shreyas Atre <[email protected]>

* [Utils] Installer: Make a new const CONST_PATH_NOT_EXIST_STR

- All the strings that are paths would be set to the above variable when they are expected not to exist

Signed-off-by: Shreyas Atre <[email protected]>

* [Utils] Installer CI: Fix brew not found

- Ref: WasmEdge#2752 (comment)

Signed-off-by: Shreyas Atre <[email protected]>

* [Utils] Installer CI: Fix matrix not having python ex variable

Signed-off-by: Shreyas Atre <[email protected]>

---------

Signed-off-by: Shreyas Atre <[email protected]>
Signed-off-by: satacker <[email protected]>
Co-authored-by: satacker <[email protected]>
  • Loading branch information
SAtacker and satacker authored Aug 31, 2023
1 parent b70f48c commit f6d99c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/test-python-install-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ jobs:

- name: Install python
run: |
eval $(/opt/homebrew/bin/brew shellenv)
${{ matrix.package_manager }} install python
- name: Install WasmEdge latest release
Expand Down Expand Up @@ -409,15 +410,15 @@ jobs:
- name: Check for differences in the installation
if: ${{ matrix.name != 'MacOS-arm64' }}
run: |
PYTHON_EXECUTABLE=${{ matrix.python3_ex }} bash utils/installer_changes.sh "$HOME"/.wasmedge
PYTHON_EXECUTABLE=${{ matrix.python3_ex }} bash utils/installer_changes.sh "$HOME"/new_folder
PYTHON_EXECUTABLE=${{ matrix.python3_ex }} bash utils/installer_changes.sh /usr/local
PYTHON_EXECUTABLE=${{ matrix.python3_ex }} bash utils/installer_changes.sh /usr
PYTHON_EXECUTABLE=python3 bash utils/installer_changes.sh "$HOME"/.wasmedge
PYTHON_EXECUTABLE=python3 bash utils/installer_changes.sh "$HOME"/new_folder
PYTHON_EXECUTABLE=python3 bash utils/installer_changes.sh /usr/local
PYTHON_EXECUTABLE=python3 bash utils/installer_changes.sh /usr
PYTHON_EXECUTABLE=${{ matrix.python3_ex }} bash utils/installer_changes.sh "$HOME"/.wasmedge "-e all" "-v 0.12.1"
PYTHON_EXECUTABLE=${{ matrix.python3_ex }} bash utils/installer_changes.sh "$HOME"/new_folder "-e all" "-v 0.12.1"
PYTHON_EXECUTABLE=${{ matrix.python3_ex }} bash utils/installer_changes.sh /usr/local "-e all" "-v 0.12.1"
PYTHON_EXECUTABLE=${{ matrix.python3_ex }} bash utils/installer_changes.sh /usr "-e all" "-v 0.12.1"
PYTHON_EXECUTABLE=python3 bash utils/installer_changes.sh "$HOME"/.wasmedge "-e all" "-v 0.12.1"
PYTHON_EXECUTABLE=python3 bash utils/installer_changes.sh "$HOME"/new_folder "-e all" "-v 0.12.1"
PYTHON_EXECUTABLE=python3 bash utils/installer_changes.sh /usr/local "-e all" "-v 0.12.1"
PYTHON_EXECUTABLE=python3 bash utils/installer_changes.sh /usr "-e all" "-v 0.12.1"
- name: Latest Release Check
run: |
Expand Down
7 changes: 7 additions & 0 deletions utils/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ def compare(self, version2, separator=". |-", ignorecase=True):
CONST_lib_ext = None
CONST_env_path = None
CONST_lib_dir = "lib"
CONST_PATH_NOT_EXIST_STR = "/DOES NOT EXIST;"

try:
mkdir(TEMP_PATH)
Expand Down Expand Up @@ -1611,6 +1612,12 @@ def main(args):
# Cleanup
shutil.rmtree(TEMP_PATH)

if CONST_shell_config is None:
CONST_shell_config = CONST_PATH_NOT_EXIST_STR

if CONST_shell_profile is None:
CONST_shell_profile = CONST_PATH_NOT_EXIST_STR

if exists(CONST_shell_config) and compat.platform != "Darwin":
logging.info("Run:\nsource {0}".format(CONST_shell_config))
elif exists(CONST_shell_profile):
Expand Down

0 comments on commit f6d99c8

Please sign in to comment.