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

Problem: mr.developer broken by CLI arg to avoid endless loop #536

Merged
merged 1 commit into from
Mar 2, 2021

Conversation

gotcha
Copy link
Member

@gotcha gotcha commented Sep 29, 2020

Solution: use environment variable instead

See #515

if not __debug__:
args.insert(0, '-O')
args.insert(0, sys.executable)
sys.exit(subprocess.call(args))
env = {'BUILDOUT_RESTART_AFTER_UPGRADE': '1'}
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be something like

        env = dict(os.environ, BUILDOUT_RESTART_AFTER_UPGRADE='1')

to also preserve environment from current process variables ?

Copy link
Member Author

Choose a reason for hiding this comment

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

@perrinjerome Right, I missed that.

@@ -2161,8 +2161,6 @@ def main(args=None):
_help()
elif orig_op == '--version':
_version()
elif orig_op == '--restart-after-upgrade':
options.append(('buildout', 'restart-after-upgrade', "true"))
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious as to what happens if a zc.buildout before this patch upgrades itself to a version after this patch. Will the old buildout add --restart-after-upgrade to the command line, causing the new buildout to fail with an unknown command line argument error?

Copy link
Member Author

Choose a reason for hiding this comment

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

@mgedmin --restart-after-upgrade only exist in 3.0.0a1 and 3.0.0a2

I feel we do not need to cover those alpha versions. What is your take on that ?

Copy link
Member

Choose a reason for hiding this comment

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

Good point! I forgot when it was introduced; seemed like ages ago.

@mgedmin
Copy link
Member

mgedmin commented Sep 30, 2020

Do you have a link to a mr.developer bug, or a traceback, or something for us to see how mr. developer fails?

@mgedmin
Copy link
Member

mgedmin commented Sep 30, 2020

The CI failures I looked at seem to be caused by Python version deprecation warnings. Didn't we have a fix for that in some other PR? Perhaps, since the fix consisted of putting an environment variable asking pip not to print those warnings, the fix may have broken for the reason @perrinjerome noticed: that environment variable is now lost when you replace the entire environment.

@mgedmin
Copy link
Member

mgedmin commented Sep 30, 2020

Didn't we have a fix for that in some other PR?

Ah, not yet: #534. Still, the CI fix will need the environment to be preserved.

@gotcha
Copy link
Member Author

gotcha commented Sep 30, 2020

I added the link to #515 in the description.

Solution: use environment variable instead
@icemac
Copy link

icemac commented Jan 26, 2021

Is there still something needed to be done before merging this PR?

@ZachArani
Copy link
Contributor

Is there still something needed to be done before merging this PR?

I second this. Just found this issue rearing its ugly head in my workflows.

@gotcha gotcha merged commit c2d6341 into master Mar 2, 2021
@icemac icemac deleted the refactor-no-endless-loop branch March 3, 2021 07:14
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.

None yet

5 participants