From 4047b9d32a66acfde9c040144b9d41b1770d32af Mon Sep 17 00:00:00 2001 From: Thorsten Kaufmann Date: Thu, 24 Mar 2022 23:06:34 +0100 Subject: [PATCH 01/10] Fix #1258 --- install.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/install.py b/install.py index 9d88a1084..3e1681c34 100644 --- a/install.py +++ b/install.py @@ -25,6 +25,7 @@ # from rez.utils._version import _rez_version # noqa: E402 from rez.utils.which import which # noqa: E402 +from rez.utils.platform_ import platform_ # noqa: E402 from rez.cli._entry_points import get_specifications # noqa: E402 from rez.vendor.distlib.scripts import ScriptMaker # noqa: E402 @@ -84,10 +85,21 @@ def patch_rez_binaries(dest_dir): specs = get_specifications() # delete rez bin files written into virtualenv - for name in specs.keys(): - filepath = os.path.join(virtualenv_bin_path, name) - if os.path.isfile(filepath): - os.remove(filepath) + if not platform_.os.startswith("windows"): + for name in specs.keys(): + filepath = os.path.join(virtualenv_bin_path, name) + if os.path.isfile(filepath): + os.remove(filepath) + else: + for name in specs.keys(): + filepaths = [ + os.path.join(virtualenv_bin_path, name) + "-script.py", + os.path.join(virtualenv_bin_path, name) + ".exe" + ] + if os.path.isfile(filepaths[0]): + os.remove(filepaths[0]) + if os.path.isfile(filepaths[1]): + os.remove(filepaths[1]) # write patched bins instead. These go into 'bin/rez' subdirectory, which # gives us a bin dir containing only rez binaries. This is what we want - From 9e1836b32187e522d55e1693e7a6b2495be6e03b Mon Sep 17 00:00:00 2001 From: Thorsten Kaufmann Date: Thu, 24 Mar 2022 23:13:37 +0100 Subject: [PATCH 02/10] Remove duplicate code --- install.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/install.py b/install.py index 3e1681c34..4e0c58dda 100644 --- a/install.py +++ b/install.py @@ -96,10 +96,9 @@ def patch_rez_binaries(dest_dir): os.path.join(virtualenv_bin_path, name) + "-script.py", os.path.join(virtualenv_bin_path, name) + ".exe" ] - if os.path.isfile(filepaths[0]): - os.remove(filepaths[0]) - if os.path.isfile(filepaths[1]): - os.remove(filepaths[1]) + for filepath in filepaths: + if os.path.isfile(filepath): + os.remove(filepath) # write patched bins instead. These go into 'bin/rez' subdirectory, which # gives us a bin dir containing only rez binaries. This is what we want - From 30d9c1443b0fcc17736ee63eadc5115d90f5a337 Mon Sep 17 00:00:00 2001 From: Thorsten Kaufmann Date: Thu, 24 Mar 2022 23:17:35 +0100 Subject: [PATCH 03/10] Remove platform_ dependency and simplify code --- install.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/install.py b/install.py index 4e0c58dda..7b57a8691 100644 --- a/install.py +++ b/install.py @@ -25,7 +25,6 @@ # from rez.utils._version import _rez_version # noqa: E402 from rez.utils.which import which # noqa: E402 -from rez.utils.platform_ import platform_ # noqa: E402 from rez.cli._entry_points import get_specifications # noqa: E402 from rez.vendor.distlib.scripts import ScriptMaker # noqa: E402 @@ -85,20 +84,16 @@ def patch_rez_binaries(dest_dir): specs = get_specifications() # delete rez bin files written into virtualenv - if not platform_.os.startswith("windows"): - for name in specs.keys(): - filepath = os.path.join(virtualenv_bin_path, name) + for name in specs.keys(): + basepath = os.path.join(virtualenv_bin_path, name) + filepaths = [ + basepath, + basepath + "-script.py", + basepath + ".exe" + ] + for filepath in filepaths: if os.path.isfile(filepath): os.remove(filepath) - else: - for name in specs.keys(): - filepaths = [ - os.path.join(virtualenv_bin_path, name) + "-script.py", - os.path.join(virtualenv_bin_path, name) + ".exe" - ] - for filepath in filepaths: - if os.path.isfile(filepath): - os.remove(filepath) # write patched bins instead. These go into 'bin/rez' subdirectory, which # gives us a bin dir containing only rez binaries. This is what we want - From 0a38b8a468ee08f1a5f7d3b7e6ed5479dda489b0 Mon Sep 17 00:00:00 2001 From: Thorsten Kaufmann Date: Wed, 20 Apr 2022 22:24:26 +0200 Subject: [PATCH 04/10] Add os matrix, rename method matrix entries --- .github/workflows/installation.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/installation.yaml b/.github/workflows/installation.yaml index f58d17b61..f03cd0230 100644 --- a/.github/workflows/installation.yaml +++ b/.github/workflows/installation.yaml @@ -13,12 +13,16 @@ jobs: runs-on: ubuntu-latest strategy: matrix: + os: + - ubuntu-latest + - macOS-latest + - windows-2019 python-version: - '2.7' - '3.7' method: - - 'python ./install.py' - - 'pip install --target /opt/rez .' + - 'install' + - 'pip' include: - method: 'python ./install.py' exports: 'PATH=${PATH}:/opt/rez/bin/rez' From 89c607094236dca46cde9b0e9a729f6a6f789766 Mon Sep 17 00:00:00 2001 From: Thorsten Kaufmann Date: Wed, 20 Apr 2022 22:25:06 +0200 Subject: [PATCH 05/10] Replace include entries for cross platform support --- .github/workflows/installation.yaml | 31 +++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/installation.yaml b/.github/workflows/installation.yaml index f03cd0230..2c8ad9342 100644 --- a/.github/workflows/installation.yaml +++ b/.github/workflows/installation.yaml @@ -24,10 +24,33 @@ jobs: - 'install' - 'pip' include: - - method: 'python ./install.py' - exports: 'PATH=${PATH}:/opt/rez/bin/rez' - - method: 'pip install --target /opt/rez .' - exports: 'PATH=${PATH}:/opt/rez/bin PYTHONPATH=${PYTHONPATH}:/opt/rez' + # ubuntu + - os: ubuntu-latest + method: install + REZ_SET_PATH_COMMAND: 'export PATH=${PATH}:/opt/rez/bin/rez' + REZ_INSTALL_COMMAND: 'python ./install.py /opt/rez' + - os: ubuntu-latest + method: pip + REZ_SET_PATH_COMMAND: 'export PATH=${PATH}:/opt/rez/bin PYTHONPATH=${PYTHONPATH}:/opt/rez' + REZ_INSTALL_COMMAND: 'pip install --target /opt/rez .' + # macOS + - os: macOS-latest + method: install + REZ_SET_PATH_COMMAND: 'export PATH=${PATH}:~/rez/bin/rez' + REZ_INSTALL_COMMAND: 'python ./install.py ~/rez' + - os: macOS-latest + method: pip + REZ_SET_PATH_COMMAND: 'export PATH="$PATH:~/rez/bin" PYTHONPATH=$PYTHONPATH:$HOME/rez' + REZ_INSTALL_COMMAND: 'pip install --target ~/rez .' + # windows + - os: windows-2019 + method: install + REZ_SET_PATH_COMMAND: '$env:PATH="$env:PATH;C:\ProgramData\rez\Scripts\rez"' + REZ_INSTALL_COMMAND: 'python ./install.py C:\ProgramData\rez' + - os: windows-2019 + method: pip + REZ_SET_PATH_COMMAND: '[System.Environment]::SetEnvironmentVariable("PATH","$env:PATH;C:\ProgramData\rez\bin"); $env:PYTHONPATH="$env:PYTHONPATH;C:\ProgramData\rez"' + REZ_INSTALL_COMMAND: 'pip install --target C:\ProgramData\rez .' steps: - uses: actions/checkout@v2 From e8a04321fdd62ef731167652beae7fe9219e3070 Mon Sep 17 00:00:00 2001 From: Thorsten Kaufmann Date: Wed, 20 Apr 2022 22:25:35 +0200 Subject: [PATCH 06/10] Remove import test (to be re-done separately --- .github/workflows/installation.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/installation.yaml b/.github/workflows/installation.yaml index 2c8ad9342..1f4518dae 100644 --- a/.github/workflows/installation.yaml +++ b/.github/workflows/installation.yaml @@ -74,13 +74,3 @@ jobs: rez-pip --install . rez view rez - - name: Import rez package in Python - run: | - export ${{ matrix.exports }} - - # Still needed as there's no fallback to use system's python - # TODO update once 'provides' mechanism is implemented - rez bind python - - echo "Checking rez as python package:" - rez env rez -- python -c 'import rez;print(rez.__file__)' From 078cea777701adbd26c9e5f37ff4d5a256680fd4 Mon Sep 17 00:00:00 2001 From: Thorsten Kaufmann Date: Wed, 20 Apr 2022 22:25:56 +0200 Subject: [PATCH 07/10] Update steps to reflect include entry changes --- .github/workflows/installation.yaml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/installation.yaml b/.github/workflows/installation.yaml index 1f4518dae..72dc8e2f6 100644 --- a/.github/workflows/installation.yaml +++ b/.github/workflows/installation.yaml @@ -60,17 +60,14 @@ jobs: - name: Install run: | - ${{ matrix.method }} - find /opt/rez/ -maxdepth 2 + ${{ matrix.REZ_INSTALL_COMMAND }} - - name: rez status + - name: Run rez-status run: | - export ${{ matrix.exports }} - rez status + ${{ matrix.REZ_SET_PATH_COMMAND }} + rez-status - - name: rez-pip --install . + - name: Install rez with rez-pip run: | - export ${{ matrix.exports }} + ${{ matrix.REZ_SET_PATH_COMMAND }} rez-pip --install . - rez view rez - From bdab1f72f3fea2d65a27f07a5f42a498e1909d30 Mon Sep 17 00:00:00 2001 From: Thorsten Kaufmann Date: Wed, 20 Apr 2022 22:41:04 +0200 Subject: [PATCH 08/10] Update job name --- .github/workflows/installation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/installation.yaml b/.github/workflows/installation.yaml index 72dc8e2f6..38fe70967 100644 --- a/.github/workflows/installation.yaml +++ b/.github/workflows/installation.yaml @@ -9,7 +9,7 @@ on: jobs: main: - name: ${{ matrix.python-version }} - ${{ matrix.method }} + name: ${{ matrix.os }} - ${{ matrix.python-version }} - ${{ matrix.method }} runs-on: ubuntu-latest strategy: matrix: From f8cb6847ca5319a689530ef26443cf2414d6a7c3 Mon Sep 17 00:00:00 2001 From: Thorsten Kaufmann Date: Wed, 20 Apr 2022 22:51:54 +0200 Subject: [PATCH 09/10] Update runs-on --- .github/workflows/installation.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/installation.yaml b/.github/workflows/installation.yaml index 38fe70967..ebca554ad 100644 --- a/.github/workflows/installation.yaml +++ b/.github/workflows/installation.yaml @@ -10,7 +10,7 @@ on: jobs: main: name: ${{ matrix.os }} - ${{ matrix.python-version }} - ${{ matrix.method }} - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: matrix: os: @@ -23,6 +23,7 @@ jobs: method: - 'install' - 'pip' + include: # ubuntu - os: ubuntu-latest @@ -51,7 +52,7 @@ jobs: method: pip REZ_SET_PATH_COMMAND: '[System.Environment]::SetEnvironmentVariable("PATH","$env:PATH;C:\ProgramData\rez\bin"); $env:PYTHONPATH="$env:PYTHONPATH;C:\ProgramData\rez"' REZ_INSTALL_COMMAND: 'pip install --target C:\ProgramData\rez .' - + steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 @@ -70,4 +71,4 @@ jobs: - name: Install rez with rez-pip run: | ${{ matrix.REZ_SET_PATH_COMMAND }} - rez-pip --install . + rez-pip --install . \ No newline at end of file From 1f05bd41fd730e314e78dea9a43190ba65f47c94 Mon Sep 17 00:00:00 2001 From: Thorsten Kaufmann Date: Thu, 21 Apr 2022 00:16:03 +0200 Subject: [PATCH 10/10] Add pull_request trigger --- .github/workflows/installation.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/installation.yaml b/.github/workflows/installation.yaml index ebca554ad..08415d0bf 100644 --- a/.github/workflows/installation.yaml +++ b/.github/workflows/installation.yaml @@ -1,6 +1,12 @@ name: installation on: - push: + pull_request: + paths: + - 'src/**' + - '.github/workflows/installation.yaml' + - '!src/rez/utils/_version.py' + - '!**.md' + push: paths: - 'src/**' - '.github/workflows/installation.yaml'