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

No equivalent of Fabric's env.real_fabfile? #634

Open
joshourisman opened this issue Apr 4, 2019 · 1 comment

Comments

@joshourisman
Copy link

@joshourisman joshourisman commented Apr 4, 2019

I may just be missing something, but in trying to port some old fabfiles over to Invoke, I'm at a loss for figuring out how to determine the path to my tasks file. With Fabric I was able to use env.real_fabfile to get a filesystem path for the location of my fabfile/module, which allowed me to use PROJECT_ROOT = os.path.join(env.real_fabfile, "../") to ensure that I could always construct a relative path from the top directory of my project. This usefully allowed me to not care where in my project's directory tree I was running my Fabric tasks from (or where on any specific computer's drive my project was located) and still be confident that I could construct relative paths to files in my project. I'm not seeing anything similar in Invoke. (The migration documentation mentioned loaded_from as the port of real_fabfile, but I don't see any way to access that from within my tasks.)

@joshourisman

This comment has been minimized.

Copy link
Author

@joshourisman joshourisman commented Apr 12, 2019

Perhaps this is just the correct way to do it, but for now I'm simply using os.path.join(os.path.dirname(__file__), "..") for the same purpose. Since I have a fairly complex module, rather than a single tasks.py file, I'm just keeping it in a file of helper functions that my various task files can import from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.