bootstrap.py TypeError error in python3
Categories
(Firefox Build System :: Bootstrap Configuration, defect, P3)
Tracking
(firefox74 fixed)
Tracking | Status | |
---|---|---|
firefox74 | --- | fixed |
People
(Reporter: matt, Assigned: rstewart)
References
Details
(Keywords: in-triage)
Attachments
(2 files)
915 bytes,
patch
|
Details | Diff | Splinter Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:72.0) Gecko/20100101 Firefox/72.0
Steps to reproduce:
Followed the instructions at: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Mac_OS_X_Prerequisites
Specifically downloaded bootstrap.py (python/mozboot/mozboot/bootstrap.py@5fd4cfacc90ddd975c82ba27fdc56f4187b3f180 ) and with python3 as my interpreter:
$ python bootstrap.py
(Note, I was able to bootstrap successfully with python2.)
Actual results:
...
Traceback (most recent call last):
File "bootstrap.py", line 195, in <module>
sys.exit(main(sys.argv))
File "bootstrap.py", line 186, in main
dasboot.bootstrap()
File "/var/folders/2q/npkhtcmd0vx_98jlhmj_jcxc0000gn/T/tmpxj7679x8/mozboot/bootstrap.py", line 497, in bootstrap
File "/var/folders/2q/npkhtcmd0vx_98jlhmj_jcxc0000gn/T/tmpxj7679x8/mozboot/bootstrap.py", line 618, in hg_clone_firefox
TypeError: a bytes-like object is required, not 'str'
Expected results:
Script should not have bombed.
Reporter | ||
Comment 1•5 years ago
|
||
The issue appears to be here:
https://hg.mozilla.org/mozilla-central/file/tip/python/mozboot/mozboot/bootstrap.py#l617
Specifically:
with open(os.path.join(dest, '.hg', 'hgrc'), 'ab') as fh:
fh.write('[paths]\n')
Opening a file in binary mode and writing a string will cause a TypeError in python3, but not python2.
Fix should be to just open the file in text mode.
Reporter | ||
Comment 2•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 3•5 years ago
|
||
Hi Matt -- thanks for the patch. Can you submit it on Phabricator? You can set firefox-build-system-reviewers as the reviewer and I'll sign off on it.
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/How_to_Submit_a_Patch
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Reporter | ||
Comment 4•5 years ago
|
||
Reporter | ||
Comment 5•5 years ago
|
||
Hi Ricky -- I submitted the patch to Phabricator. While doing some extra testing locally, I realized that the bootstrap process still bombs out in python3, trying to import urlparse
, which was renamed in py3. I'm happy to go down the rabbit hole here, but before I do, I just want to make sure that the bootstrap process is intended to be py3 compatible. I assumed it would be since py2 is EOL now, but if this hasn't been a priority yet, it could be a bigger project than just fixing a few imports. So, I guess, let me know if you think it's worthwhile to pull this thread or if my efforts would be better placed elsewhere.
Assignee | ||
Comment 6•5 years ago
|
||
Hi Matt, thanks for checking in. Yes, bootstrapping should work with Python 3. :) Bug 1568964 tracks this work.
Unfortunately I think it will be a bigger problem than fixing a few imports. Namely, bug 1568964 depends on bug 1524639 which is going to be more complicated and is something that I'll probably be working on myself.
You're still welcome to submit patches for obvious issues as you find them, but I wouldn't recommend going on the rabbit hole on this particular issue unless you're ready to go deeper than you might have anticipated :)
Comment 8•5 years ago
|
||
bugherder |
Description
•