Skip to content
Marcus Ottosson edited this page Jul 3, 2019 · 6 revisions

alias() on Windows with cmd

  • Utilises doskey, which works similar to alias on Linux
  • Does not work with rez env -- arbitrary command
  • Does not carry across shell, e.g. start
  • Does not respect cmd.exe scope, e.g. cmd /Q /K doskey python=c:\python27\python.exe $* affects parent too

PowerShell

  • --% as argument bypasses interpretation of special characters from thereon out

Process Tree

Rez runs in a shell like cmd, powershell and bash which spawns a Python process, spawning another shell. Here's what spawning your own Python session from within a Rez context looks like.

image


Assets

  • Single-digit versions, e.g. v001
  • Representations stored as minor, patch e.g. v001.fx for particles, v001.rbd for collision mesh, v001.lod0 for LODs
  • Metadata stored in package.py, e.g. label, icon, comment and timestamp

API

from rez import api
new_context = api.env("python-3", "alita", "six")
current_context = api.context()
loaded_context = api.context("mycontext.rxt")
versions = api.search("maya")
latest = next(versions)
api.call("mayapy", context)

Legend

  • Repository
  • Package
  • Resource
  • Variant
  • FileSystemPackageResource
  • FileSystemVariantResource
  • Family

Windows Gotchas

You'll want to use a brutal platform_map for your Windows setup, because of stunts like this.

Machine A

$ C:\Users\marcus\Desktop>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.17134 N/A Build 17134
$ python
>>> import platform
>>> platform.platform()
'Windows-8-6.2.9200'
>>> from rez.utils.platform_ import platform_
>>> platform_.os
'windows-6.2.9200'

Machine B

$ C:\Users\marcus\Desktop>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.18362 N/A Build 18362
$ python
>>> import platform
>>> platform.platform()
'Windows-10-10.0.18362'
>>> from rez.utils.platform_ import platform_
>>> platform_.os
'windows-10.0.18362.SP0'

rezconfig.py

For a platform_map, try this one on for size. I'll make any modern version of Windows (8-10) into Windows 10.

platform_map = {
    "os": {
        r"windows-6(.*)": r"windows-10",
        r"windows-10(.*)": r"windows-10",
    },
}
Clone this wiki locally