Closed Bug 1257095 Opened 4 years ago Closed 3 years ago

bootstrap.py fails on arch linux with ImportError: No module named 'StringIO'

Categories

(Firefox Build System :: General, defect)

defect
Not set

Tracking

(firefox49 fixed)

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: sbforman, Assigned: Nat)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Build ID: 20160308181531

Steps to reproduce:

i opened up my terminal and typed:
wget -q https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py -O bootstrap.py && python bootstrap.py

i am runing Linux arche 4.4.3-1-ARCH


Actual results:

this was returned in terminal:

Traceback (most recent call last):
  File "bootstrap.py", line 19, in <module>
    from StringIO import StringIO
ImportError: No module named 'StringIO'

also a file named "bootstrap.py" was downloaded in the same derectory where the comand was run. when i try  python bootstrap.py i get the same error as above.


Expected results:

i was trying to build firefox for the first time.
this fails with python 3 my defalt. but works with python2
We should rewrite the bootstrapper to work on Python 3.

A quick fix would be to have the bootstrapper detect when it is running on Python 3 and print an error message saying to run on Python 2. I don't like that fix because people may need to figure out how to install Python 2. But it is better than print a stack.
Assignee: nobody → nhakkakzadeh
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #8756082 - Flags: review?(gps)
Comment on attachment 8756082 [details]
MozReview Request: Bug 1257095 - Bootstrapper now checks if Python interpreter is version 2.6 or 2.7 so users get a readable error instead of a stack trace. r?gps

https://reviewboard.mozilla.org/r/54948/#review51618

::: python/mozboot/bin/bootstrap.py:18
(Diff revision 1)
>  # If we add unicode_literals, optparse breaks on Python 2.6.1 (which is needed
>  # to support OS X 10.6).
> +
> +import sys
> +if sys.version_info[:2] not in [(2, 6), (2, 7)]:
> +    print("Python 2.6 or 2.7 is currently required to run bootstrap. Please re-run with `python2.7` or `python2`")

I'm going to bikeshed the message a bit here.

We want it to be a bit actionable. So how about a more detailed message saved in a ''' string:

Bootstrap currently only runs on Python 2.7 or Python 2.6. Please try re-running with `python2.7` or `python2.6`.

If these aren't available on your system, you may need to install them. Look for a "python2" or "python27" package in your package manager.

::: python/mozboot/bin/bootstrap.py:19
(Diff revision 1)
>  # to support OS X 10.6).
> +
> +import sys
> +if sys.version_info[:2] not in [(2, 6), (2, 7)]:
> +    print("Python 2.6 or 2.7 is currently required to run bootstrap. Please re-run with `python2.7` or `python2`")
> +    sys.exit()

sys.exit(1) to indicate failure.

::: python/mozboot/bin/bootstrap.py:21
(Diff revision 1)
> +import sys
> +if sys.version_info[:2] not in [(2, 6), (2, 7)]:
> +    print("Python 2.6 or 2.7 is currently required to run bootstrap. Please re-run with `python2.7` or `python2`")
> +    sys.exit()
> +
>  from __future__ import print_function

The `__future__` import special in that it must be the first statement in a Python module to have an effect IIRC. So the new code needs to come after this import.
Comment on attachment 8756082 [details]
MozReview Request: Bug 1257095 - Bootstrapper now checks if Python interpreter is version 2.6 or 2.7 so users get a readable error instead of a stack trace. r?gps

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/54948/diff/1-2/
Attachment #8756082 - Attachment description: MozReview Request: Bug 1257095 - Bootstrapper now checks if Python interpreter is version 2.6 or 2.7 so users get a readable error instead of a stack trace. r?gps → MozReview Request: Bug 1257095 - Fixed Python version check in bootstrapper. r?gps
Attachment #8756082 - Flags: review?(gps)
Comment on attachment 8756082 [details]
MozReview Request: Bug 1257095 - Bootstrapper now checks if Python interpreter is version 2.6 or 2.7 so users get a readable error instead of a stack trace. r?gps

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/54948/diff/2-3/
Attachment #8756082 - Attachment description: MozReview Request: Bug 1257095 - Fixed Python version check in bootstrapper. r?gps → MozReview Request: Bug 1257095 - Bootstrapper now checks if Python interpreter is version 2.6 or 2.7 so users get a readable error instead of a stack trace. r?gps
Comment on attachment 8756082 [details]
MozReview Request: Bug 1257095 - Bootstrapper now checks if Python interpreter is version 2.6 or 2.7 so users get a readable error instead of a stack trace. r?gps

https://reviewboard.mozilla.org/r/54948/#review51634
Attachment #8756082 - Flags: review?(gps) → review+
https://hg.mozilla.org/mozilla-central/rev/b946d6af2776
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.