Skip to content

Commit

Permalink
Merge branch 'bug/1258_rez_executables_not_removed_on_windows' of htt…
Browse files Browse the repository at this point in the history
…ps://github.com/instinct-vfx/rez into instinct-vfx-bug/1258_rez_executables_not_removed_on_windows
  • Loading branch information
nerdvegas committed Jun 14, 2022
2 parents 9840091 + 1f05bd4 commit 9e3acf1
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 33 deletions.
81 changes: 51 additions & 30 deletions .github/workflows/installation.yaml
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -9,22 +15,50 @@ on:

jobs:
main:
name: ${{ matrix.python-version }} - ${{ matrix.method }}
runs-on: ubuntu-latest
name: ${{ matrix.os }} - ${{ matrix.python-version }} - ${{ matrix.method }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macOS-latest
- windows-2019
python-version:
- '2.7'
- '3.7'
method:
- 'python ./install.py'
- 'pip install --target /opt/rez .'
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'
- 'install'
- 'pip'

include:
# 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
- uses: actions/setup-python@v2
Expand All @@ -33,27 +67,14 @@ jobs:

- name: Install
run: |
${{ matrix.method }}
find /opt/rez/ -maxdepth 2
- name: rez status
run: |
export ${{ matrix.exports }}
rez status
${{ matrix.REZ_INSTALL_COMMAND }}
- name: rez-pip --install .
- name: Run rez-status
run: |
export ${{ matrix.exports }}
rez-pip --install .
rez view rez
${{ matrix.REZ_SET_PATH_COMMAND }}
rez-status
- name: Import rez package in Python
- name: Install rez with rez-pip
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__)'
${{ matrix.REZ_SET_PATH_COMMAND }}
rez-pip --install .
12 changes: 9 additions & 3 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,15 @@ def patch_rez_binaries(dest_dir):

# 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)
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)

# 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 -
Expand Down

0 comments on commit 9e3acf1

Please sign in to comment.