Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need currently-building-variant build variables #416

Closed
maxnbk opened this issue Apr 3, 2017 · 5 comments
Closed

Need currently-building-variant build variables #416

maxnbk opened this issue Apr 3, 2017 · 5 comments

Comments

@maxnbk
Copy link
Contributor

maxnbk commented Apr 3, 2017

Currently the only helpful variable provided at build time to identify the variant currently building is:
REZ_BUILD_VARIANT_INDEX="#", being the zero-indexed ID of the currently building variant from the package.py.

Currently the only way to get a readable variant listing at build time is to either have the build script parse the build-path, subtract the project-path off the front, or to use the index to read and locate the variant in the package.py, neither of which is super ideal.

It would instead be grand if there were something to the effect of:
REZ_BUILD_VARIANT="thing-1.2.3,other-2.3.4,another-3.4.5"
The delimiter used I think is largely relevant as long as it doesn't have another meaning, commas, spaces, slashes probably all solid choices.

Perhaps setting one that does not include implicit-packages in the list, so that platform/arch/os would not be a part of the listing, set to another variable with a similarly short but hopefully descriptive name.

@ttanimura
Copy link

+1

I'm not sure if Max's request also encompasses this situation, but we created some wrapper packages to expose our existing libs to Rez. These wrappers need to do some path munging inside these packages at build time:

def commands():
    if building:

        if using variant 0:
            # do some path manipulation
        elif using variant 1:
            # do some other path manipulation

        # expose result of path manipulation to env

So having access to what variant of the package is being used would be super helpful.

@ttanimura
Copy link

After some digging, I found that I was able to get the variant index in commands() using:

resolve.PACKAGENAME._VariantBinding__variant.index

Looking at the VariantBinding class in rex_bindings.py, it appears that if the packages.Variant object inside the class were accessible, either directly via a getter, or perhaps exposing its attrs via __getattr__ or similar, the problem would be solved.

@nerdvegas
Copy link
Contributor

nerdvegas commented Apr 7, 2017 via email

@ttanimura
Copy link

ttanimura commented Apr 7, 2017

Ah, perfect. Will update to the latest and give that a shot. Thank you!

nerdvegas pushed a commit that referenced this issue Dec 5, 2018
@nerdvegas nerdvegas mentioned this issue Dec 13, 2018
@nerdvegas
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants