Skip to content

bpo-38691 Added a switch to ignore PYTHONCASEOK when -E or -I flags passed #18314

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

Merged
merged 8 commits into from
Feb 17, 2020

Conversation

idomic
Copy link
Contributor

@idomic idomic commented Feb 2, 2020

@idomic
Copy link
Contributor Author

idomic commented Feb 2, 2020

@vstinner Added a PR 👍

@idomic
Copy link
Contributor Author

idomic commented Feb 2, 2020

Not sure why the test_importlib test fails, I think it expects the value no matter what?

Copy link
Member

@corona10 corona10 left a comment

Choose a reason for hiding this comment

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

@idomic

Please run make regen-all before commit.
You can see some diffs which are generated from this command.
And please commit it after do this.

Thanks for the contribution

"""True if filenames must be checked case-insensitively.
If the -E or -I flags are used PYTHONCASEOK is ignored
"""
if sys.flags.ignore_environment:
Copy link
Member

Choose a reason for hiding this comment

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

return not sys.flags.ignore_environment and key in _os.environ

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Accepted both comments thank you!

@corona10 corona10 requested a review from vstinner February 3, 2020 14:17
@vstinner
Copy link
Member

vstinner commented Feb 5, 2020

corona10 requested a review from vstinner 2 days ago

I will not review this change: most CIs are red. Please fix it before I can look at this PR.

@idomic
Copy link
Contributor Author

idomic commented Feb 8, 2020

@idomic

Please run make regen-all before commit.
You can see some diffs which are generated from this command.
And please commit it after do this.

Thanks for the contribution

@corona10
So I ran those 3, now I have a conflict on the importlib_external.h file:

git clean -fdx
./configure --with-pydebug
make regen-all

@corona10
Copy link
Member

corona10 commented Feb 9, 2020

@idomic
Please rebase before make regen-all

@idomic
Copy link
Contributor Author

idomic commented Feb 9, 2020

@corona10 I think I might be doing something wrong.

I was cleaning the folder using: git clean -fdx
Then rebasing master into current, running ./configure --with-pydebug and make regen-all.
Then I push to remote branch and letting it merge with remote.
I have also tried to merge just this conflicted importlib file from master and take the master's version but it failed the CI.

@idomic
Copy link
Contributor Author

idomic commented Feb 11, 2020

Adding @taleinat to accelerate PR

@vstinner
Copy link
Member

This PR looks overcomplicated. It has 24 commits but only changes 1 line of code... Maybe create a new PR on top of the up to date master branch, and ensure that you run "make regen-all" to update Python/importlib_external.h.

@taleinat
Copy link
Contributor

Hi @idomic!

I think I might be doing something wrong.

Yep, it seems that you've become a bit tangled up with the git merges and rebases. The final step that caused the current mess was when, after rebasing, you allowed merging with the remote branch. Instead, you should have force-pushed the rebased branch, using git push -f (use with care!).

I suggest you (hard-) reset your branch to the commit before merging the remote branch, and then force-push it.

(Generally, for branches with an open PR, I always recommend merging rather than rebasing. This is for several reasons, one of them being avoiding issues like this. Even when you're asked "please rebase", merging will usually achieve the same end result in terms of the files, but make following and managing the PR simpler.)

@idomic idomic force-pushed the PYTHONCASEOK branch 2 times, most recently from 334d852 to 3e872b2 Compare February 11, 2020 13:13
@idomic
Copy link
Contributor Author

idomic commented Feb 11, 2020

Thanks for the quick help @taleinat

So Once hard resetting and cherry picking the CI starts running, windows x64 fails on:
"D:\a\cpython\cpython\PCbuild_freeze_importlib.vcxproj(146,5): error : If you are not developing on Windows but you see this error on a continuous integration build, you need to run 'make regen-all' and commit any changes."

Once I run configure with --pydebug and make regen-all it creates a conflict in the file importlib_external.h even though I'm forcing my local branch push.

@@ -0,0 +1 @@
Updated :meth:`importlib._bootstrap_external._make_relax_case` to ignore :envvar:`PYTHONCASEOK` when -E or -I flags are used.
Copy link
Member

Choose a reason for hiding this comment

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

Please avoid documenting private modules/functions in public Changelog entries. I propose:

The :mod:`importlib` module now ignore the :envvar:`PYTHONCASEOK`
environment variable when :option:`-E` or :option:`-I` command line option is used.

Please document also this incompatible change at:

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@idomic
Copy link
Contributor Author

idomic commented Feb 12, 2020

Thanks for the comments @vstinner
I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@vstinner: please review the changes made to this pull request.

@@ -1826,6 +1826,10 @@ are always available. They are listed here in alphabetical order.
Negative values for *level* are no longer supported (which also changes
the default value to 0).

.. versionchanged:: 3.9
When the command line options -E or -I is used, the environment variable
PYTHONCASEOK is ignored.
Copy link
Member

Choose a reason for hiding this comment

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

I suggest to add "now", suggestion which also added :envvar: markup:

When the command line options :option:`-E` or :option:`-I` is used,
the environment variable :envvar:`PYTHONCASEOK` is now ignored.

@@ -262,6 +262,8 @@ Changes in the Python API
* The :mod:`venv` activation scripts no longer special-case when
``__VENV_PROMPT__`` is set to ``""``.

* The :mod:`importlib` module now ignore the :envvar:`PYTHONCASEOK`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* The :mod:`importlib` module now ignore the :envvar:`PYTHONCASEOK`
* The :mod:`importlib` module now ignores the :envvar:`PYTHONCASEOK`

Copy link
Member

Choose a reason for hiding this comment

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

I have made the requested changes; please review again

Well, you didn't update this one. English is not my first language, so I'm not sure, but it should be "The module ignoreS" here, no? with an S.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, you're right regarding the English grammar here, @vstinner.

@idomic
Copy link
Contributor Author

idomic commented Feb 13, 2020

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@vstinner: please review the changes made to this pull request.

@@ -1826,6 +1826,10 @@ are always available. They are listed here in alphabetical order.
Negative values for *level* are no longer supported (which also changes
the default value to 0).

.. versionchanged:: 3.9
When the command line options :option:`-E` or :option:`-I` is used,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
When the command line options :option:`-E` or :option:`-I` is used,
When the command line options :option:`-E` or :option:`-I` are used,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix both comments now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I understood what the problem was, apparently I misconfigured my local repo so there was no up stream, now everything should pass fine.

@taleinat
Copy link
Contributor

Also, note that when you're done, you'll have to merge and regenerate Python/importlib_external.h one last time.

@idomic
Copy link
Contributor Author

idomic commented Feb 13, 2020

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@vstinner: please review the changes made to this pull request.

@codecov
Copy link

codecov bot commented Feb 16, 2020

Codecov Report

Merging #18314 into master will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #18314     +/-   ##
=========================================
  Coverage   82.11%   82.12%             
=========================================
  Files        1956     1955      -1     
  Lines      589364   584024   -5340     
  Branches    44457    44457             
=========================================
- Hits       483962   479608   -4354     
+ Misses      95750    94766    -984     
+ Partials     9652     9650      -2     
Impacted Files Coverage Δ
Lib/distutils/tests/test_bdist_rpm.py 30.00% <0.00%> (-65.00%) ⬇️
Lib/distutils/command/bdist_rpm.py 7.63% <0.00%> (-56.88%) ⬇️
Lib/test/test_urllib2net.py 76.92% <0.00%> (-13.85%) ⬇️
Lib/test/test_smtpnet.py 78.57% <0.00%> (-7.15%) ⬇️
Lib/ftplib.py 63.85% <0.00%> (-6.06%) ⬇️
Lib/test/test_ftplib.py 87.11% <0.00%> (-4.72%) ⬇️
Tools/scripts/db2pickle.py 17.82% <0.00%> (-3.97%) ⬇️
Tools/scripts/pickle2db.py 16.98% <0.00%> (-3.78%) ⬇️
Lib/test/test_socket.py 71.94% <0.00%> (-3.77%) ⬇️
Lib/test/test_asyncio/test_base_events.py 91.84% <0.00%> (-3.30%) ⬇️
... and 323 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a5cbab5...c2c2315. Read the comment docs.

@vstinner vstinner merged commit d83b660 into python:master Feb 17, 2020
@bedevere-bot
Copy link

@vstinner: Please replace # with GH- in the commit message next time. Thanks!

@vstinner
Copy link
Member

@idomic: Thanks, I merged your PR.

@idomic idomic deleted the PYTHONCASEOK branch February 17, 2020 12:16
@pablogsal
Copy link
Member

@vstinner This PR is likely to be the cause of https://buildbot.python.org/all/#/builders/275/builds/245

@vstinner
Copy link
Member

vstinner added a commit that referenced this pull request Feb 19, 2020
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.

7 participants