Skip to content

Rez-Bind: Override Built-in Bind Modules #1557

@Pantsworth

Description

@Pantsworth

Hi Rez folks!

I'm interested in overriding the built-in behavior of the os.py and arch.py bind modules, so I added custom versions to bind_module_path in rezconfig.

Unfortunately, search path ordering in package_bind.py means that the builtin bind modules end up taking priority over user-defined modules.

I would expect the user-defined modules to override the builtins (this is how plugin_path works, for example -- a custom env.py overrides the builtin env.py command).

searchpaths = config.bind_module_path + [builtin_path]

Environment

  • macOS 13
  • Rez 2.111.3
  • Python 3.9.10

To Reproduce

  1. Create a custom bind_modules directory
  2. Create a file named "bind_modules/os.py"
  3. Add a custom bind module creation script to os.py
  4. Add bind_modules directory to REZ_BIND_MODULE_PATH
  5. Delete current os package, and call rez-bind os

Expected behavior
My expectation is that my custom os.py module will be called.

Actual behavior
The builtin os.py is called.

Related Issues/PRs
Happy to file a PR for this one - I think it's a matter of changing:

searchpaths = config.bind_module_path + [builtin_path]

to:

searchpaths =  [builtin_path] + config.bind_module_path

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrez-bindrez-bind related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions