-
Notifications
You must be signed in to change notification settings - Fork 175
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
pkg_deb flag decoding breaks for python3. #35
Comments
I'd believe that this is identical: Would like to see this fixed. |
Yes. We are going to fix it in this repository, not in bazelbuild/bazel. |
Let me do that. We have been seeing this issue multiple times. Motivated enough to do something. |
Though, the BUILD file and the soruce file stipulates that the py_binary(
name = "make_deb",
srcs = ["make_deb.py"],
python_version = "PY2",
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
deps = [
":archive",
"@abseil_py//absl/flags",
],
) Commenting out the
Is the python2-only thing intentional? I know that Google internally still uses Python2 predominantly. But in my team we only use Python3. Would like to understand the direction of this repo better. |
Another complicating factor is the introduction of the python toolchain (bazelbuild/bazel#7899) as of Bazel 0.27.0. Whatever my change would be, it is likely going to break for some people. |
I was looking at this a bit today. The code is just not Python3 ready.
My hunch is that I should make it PY2 strictly now, but work towards fixing
things so it easily switches to python3.
…On Mon, Jul 1, 2019 at 2:06 AM Zhongming Qu ***@***.***> wrote:
Another complicating factor is the introduction of the python toolchain (
bazelbuild/bazel#7899 <bazelbuild/bazel#7899>)
as of Bazel 0.27.0. Whatever my change would be, it is likely going to
break for some people.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#35?email_source=notifications&email_token=AAXHHHDRK4VHMJZKJXHH5QLP5GNGBA5CNFSM4HWUUFE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY5CSTY#issuecomment-507128143>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAXHHHDBR5ZNZENXOGM65DLP5GNGBANCNFSM4HWUUFEQ>
.
|
Ughh...... work in progress here. It is not pretty. AFAICT, the flags which were utf-8 encoded are manifesting as str types in Python 3, but were really the underlying byte stream. |
I agree with your opinion that the code is not python3 ready. Our team uses python3 exclusively. So we will just go ahead and patch it to work under python3 (the code breaks for python2 though). We will wait for the code to become ready. |
Also, I believe that a source of inconsistency is with the What's a good reason for not using the |
I have a PR out which updates to Python3.
On Wed, Jul 3, 2019 at 1:43 AM Zhongming Qu ***@***.***> wrote:
Also, I believe that a source of inconsistency is with the abseil.flags
python library, which produces byte[] in python2 and str in python3.
The problem was a little below that. The Python3 runtime does something
funny with the args - they are utf-8 encoded strings - but type str rather
than bytes. So they are not really strict unicode.
https://docs.python.org/3/library/sys.html#sys.argv
https://docs.python.org/3/library/os.html#os.fsencode
https://www.python.org/dev/peps/pep-0383/
abseil.flags is not really the problem.
What's a good reason for not using the argparse library? I do not think
abseil.flags python library is a better alternative for this task
specifically. Indeed, I'd argue it is worse than argparse.
argparse is probably fine. The code was written by Googlers, who are most
familiar with the abseil libraries, so whomever wrote it used that.
I will not have time to convert to argparse myself, but I will happily
review PRs which do so.
—
… You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#35?email_source=notifications&email_token=AAXHHHAHS2XPEMIDZT5Y6WLP5Q36LA5CNFSM4HWUUFE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZDKOGQ#issuecomment-507946778>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAXHHHBYMIPCCNNDLMVOXF3P5Q36LANCNFSM4HWUUFEQ>
.
|
Fixed in #47 |
From bazelbuild/bazel#7370
@jwnimmer-tri
If I'm understanding my build errors correctly, this change re-broke the py2/3 compatibility on make_deb.py that #6818 had previously fixed.
It's possible that the toolchain changes in 0.25.0 are also at fault and/or the only problem, but with the binary tagged PY2AND3, the code doesn't look correct to me on first read.
The text was updated successfully, but these errors were encountered: