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

Add operation environment variable #287

Closed
wants to merge 1 commit into from
Closed

Add operation environment variable #287

wants to merge 1 commit into from

Conversation

pawamoy
Copy link
Contributor

@pawamoy pawamoy commented Oct 7, 2020

First pass at #240.

Copy link
Member

@yajo yajo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a good first approach.

However I was hoping for a deeper refactoring of how tasks work. My idea was to run tasks always: pre-copy, post-copy, pre-update, post-update. The updatediff case is a special one that I'd like to review deeper, because tasks need to run there in the temporary subproject generated to obtain the diff.

Also I'm wondering if having a complex _tasks configuration is needed, given any script can just operate based on env variables.

What are your thoughts?

@@ -290,6 +301,9 @@ def update_diff(conf: ConfigData) -> None:
)
}
)
# At this point we'll run tasks in the current project:
# copy_local() needs to pass "update" as operation
os.environ["OPERATION"] = "update"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too much, you're altering the environment variables for all the process.

You better do:

with local.env(OPERATION='update'):
   ...

Docs: https://plumbum.readthedocs.io/en/latest/local_machine.html#environment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also consider passing an operation argument to copy_local, defaulting to copy, as it's the only place we use os.environ.get("OPERATION").

@yajo yajo added the hacktoberfest-accepted This PR is a candidate to win a T-shirt if done while the Hacktoberfest is live label Oct 8, 2020
@yajo yajo self-assigned this Oct 8, 2020
@yajo yajo added this to the v6.0.0 milestone Oct 8, 2020
@pawamoy
Copy link
Contributor Author

pawamoy commented Oct 8, 2020

I've open #288 after thinking more about this.

@pawamoy
Copy link
Contributor Author

pawamoy commented Mar 4, 2021

I'll close this, it's not ready and I won't be able to work on it any time soon.

@pawamoy pawamoy closed this Mar 4, 2021
@yajo
Copy link
Member

yajo commented Mar 5, 2021

Thanks, I'll keep it in mind when fixing #240.

@pawamoy pawamoy deleted the add-operation-env-var branch April 2, 2024 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted This PR is a candidate to win a T-shirt if done while the Hacktoberfest is live
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants