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

Expose Python standard module __file__ and __name__ to rezconfig #636

Conversation

mottosso
Copy link
Contributor

@mottosso mottosso commented May 23, 2019

Now users can fetch the absolute path to a given rezconfig like from any other module.

rezconfig.py

import os
print("The name of this rezconfig is %s" % __name__)
print("The absolute path is: %s" % os.path.dirname(__file__))

The __name__ is computed rather than hardcoded, to account for REZ_CONFIG_FILE being able to take any arbitrary file name, along with avoiding anything hardcoded.

This is expected but missing behavior I think, but additionally one specific usecase was having my rezconfig.py at the root of my Rez packages, and wanting to set paths up relative this file.

/server/packages/rezconfig.py
/server/packages/int
/server/packages/ext

Oh, and I explicitly did not let these get carried into the resulting Config object, as that would make less sense, considering it is a result of potentially many different rezconfig.py files. Hence, writing a test for this was challenging.. if you have any ideas, I'd be happy to add some.

Now users can fetch the absolute path to a given rezconfig in an expected way.
@mottosso
Copy link
Contributor Author

20 days later, could we merge this? It's the tiniest of changes.

@nerdvegas nerdvegas merged commit d7494a4 into AcademySoftwareFoundation:master Jun 22, 2019
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

Successfully merging this pull request may close these issues.

2 participants