-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix non-ASCII support for prettytoml #3176
Conversation
Python2.7 is still not working when non-ASCII character exists in package name/path or virtualenv location. But I am not going to fix it in this PR. There are other issues tracking unicode support in Python 2. |
I have a different PR (I think me and @uranusjr are both working on seeing about switching to tomlkit) but would want to see if you can review, no idea if it will even work yet though |
That's good, I will take a look into that library. |
we should put in a good testing framework like hypothesis for cases like this, I'm using that over in https://github.com/sarugaku/vistir/blob/master/tests/strategies.py#L92 @given(legal_path_chars(), legal_path_chars())
@settings(suppress_health_check=(HealthCheck.filter_too_much,))
def test_mkdir_p(base_dir, subdir):
assume(not any((dir_name in ["", ".", "./", ".."] for dir_name in [base_dir, subdir])))
assume(not (os.path.relpath(subdir, start=base_dir) == "."))
assume(os.path.abspath(base_dir) != os.path.abspath(os.path.join(base_dir, subdir)))
with vistir.compat.TemporaryDirectory() as temp_dir:
target = os.path.join(temp_dir.name, base_dir, subdir)
assume(vistir.path.abspathu(target) != vistir.path.abspathu(os.path.join(temp_dir.name, base_dir)))
target = vistir.misc.to_bytes(target, encoding="utf-8")
vistir.path.mkdir_p(target)
assert os.path.exists(target) |
I have no clue why this fixes anything but uh, i'll take it. Thank you for sorting this out, it could be a long time before we sort the issues with tomlkit out the rest of teh way. @uranusjr, any reservations? |
Thank you for contributing to Pipenv!
The issue
Fix #2737 Prettytoml doens't support non-ASCII characters well.
The fix
Since the upstream doesn't seem to be maintained anymore, I create a patch for prettytoml. The fix works well on my machine(3.7, Windows/WSL)
The checklist
news/
directory to describe this fix with the extension.bugfix
,.feature
,.behavior
,.doc
..vendor
. or.trivial
(this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.