[GHC] #9184: Allow the use of Python 3 when building GHC

#9184: Allow the use of Python 3 when building GHC -------------------------------------------+------------------------------- Reporter: aspidites | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 7.8.2 Keywords: python | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Easy (less than 1 hour) | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: -------------------------------------------+------------------------------- According to the [https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Windows wiki], it is preferred that a user have Python 2.7 installed before attempting to build GHC. As I'm on Arch Linux the default Python version is 3.4. As such, rather than simply changing the shebang line to explicitly ask for version 2, I made it so that the scripts all use syntax that works properly for versions 2.7 to 3.4. I don't think I've used anything that disallows 2.6, but don't have that version available to check against. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC -------------------------------+------------------------------------------- Reporter: aspidites | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 hour) Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | -------------------------------+------------------------------------------- Description changed by aspidites: Old description:
According to the [https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Windows wiki], it is preferred that a user have Python 2.7 installed before attempting to build GHC. As I'm on Arch Linux the default Python version is 3.4. As such, rather than simply changing the shebang line to explicitly ask for version 2, I made it so that the scripts all use syntax that works properly for versions 2.7 to 3.4. I don't think I've used anything that disallows 2.6, but don't have that version available to check against.
New description: According to the [https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation/Windows wiki], it is preferred that a user have Python 2.7 installed before attempting to build GHC. As I'm on Arch Linux the default Python version is 3.4. As such, rather than simply changing the shebang line to explicitly ask for version 2, I made it so that the scripts all use syntax that works properly for versions 2.7 to 3.4. I don't think I've used anything that disallows 2.6, but don't have that version available to check against. I should note that the changes were as minimal as possible. That is, I didn't bother refactoring to use more modern idioms (such as string substitution vs concatenation). As these are helper scripts, I doubt doing so would be much help, but I wouldn't mind doing so upon request. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC -------------------------------+------------------------------------------- Reporter: aspidites | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 hour) Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | -------------------------------+------------------------------------------- Comment (by monoidal): You've changed `lambda (f,x):` to `lambda f, x:`. They're not the same! Apart from that, looks good to me. The `__future__` import is not supported in 2.5, but that version is so old I think there's no point in supporting it (and it's likely the scripts currently don't work with it, anyway). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC -------------------------------+------------------------------------------- Reporter: aspidites | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 hour) Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | -------------------------------+------------------------------------------- Comment (by aspidites): My mistake. I've corrected this by manually unpacking the tuple. The alternative would have been to unpack the tuple as it was being sent into the lambda, but I figured this way was less disruptive. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC -------------------------------+------------------------------------------- Reporter: aspidites | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 hour) Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | -------------------------------+------------------------------------------- Comment (by monoidal): There's one more tuple unpacking in your patch: `lambda b, d, n`. I'm afraid there are more things to change for full compatibility. It seems we run the testsuite using python2 if it is detected (see defn of `PYTHON` in `testsuite/mk/boilerplate.mk`). If I change it to `PYTHON = python3`, I get several errors with `sh validate --testsuite-only`: `execfile` is no longer available (should become something like `with open(..., 'r') as f: exec(f.read())`), `from string import join` should become string's `join` method, `reduce` is no longer builtin (needs import from functools), `import thread` should become `import _thread` for 3, `sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w", 0)` fails (I stopped at that one). Would you be willing to take a look? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC -------------------------------+------------------------------------------- Reporter: aspidites | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 hour) Operating System: | Blocked By: Unknown/Multiple | Related Tickets: Type of failure: | None/Unknown | Test Case: | Blocking: | -------------------------------+------------------------------------------- Comment (by aspidites): Wow. I thought this was more trivial then it apparently is. I'll run the full test suite this weekend under both python 2 and 3 and submit another patch. I might actually just start fresh and see if I can come up with a solution that honors python 2.5 as well (though there are at least two places that are python 2.5 incompatible already). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC -------------------------------------+------------------------------------- Reporter: aspidites | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 Operating System: | hour) Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by gintas): Any progress? I ran into this while messing around with a Windows build of GHC on msys2, which uses pacman, where python3 is the default. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC -------------------------------------+------------------------------------- Reporter: aspidites | Owner: monoidal Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 Operating System: | hour) Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by monoidal): * owner: => monoidal Comment: I'm refactoring scripts to support Python 3. Not sure if I'll catch all incompatibilities; my goal is at least to successfully execute a failed and passed run under 3, and don't change the behavior over 2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC -------------------------------------+------------------------------------- Reporter: aspidites | Owner: monoidal Type: feature | Status: patch request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 Operating System: | hour) Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: Phab:D233 | -------------------------------------+------------------------------------- Changes (by monoidal): * status: new => patch * differential: => Phab:D233 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC -------------------------------------+------------------------------------- Reporter: aspidites | Owner: monoidal Type: feature | Status: patch request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 Operating System: | hour) Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: Phab:D233 | -------------------------------------+------------------------------------- Comment (by aspidites): Sorry about the delay. I replied inline while at work, but the email got kicked back because I wasn't signed in. I had this mostly done, but recently fried the motherboard on my home machine. I also was apparently foolish in that while I had changes committed locally, I didn't push them. Sorry about that. What I did find was that forsaking python 2.5 made the necessary changes rather trivial, but in my second stab at it, I was trying to preserve python 2.5 support. While the changes were trivial, there was a lot of mechanical changes that had me chasing my tail. In any case, I'm glad someone else picked up the ball on this, and apologize again for my lack of communication. I seem to be losing track of time in more than one place. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC -------------------------------------+------------------------------------- Reporter: aspidites | Owner: monoidal Type: feature | Status: patch request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 Operating System: | hour) Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: Phab:D233 | -------------------------------------+------------------------------------- Comment (by thomie): @aspidites: you could make it up for it by reviewing the final patch on [wiki:Phabricator phabricator] :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC -------------------------------------+------------------------------------- Reporter: aspidites | Owner: monoidal Type: feature | Status: patch request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 Operating System: | hour) Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: Phab:D233 | -------------------------------------+------------------------------------- Comment (by aspidites): Deal. I just set myself an alarm to do this immediately after work tomorrow. (I have a large project due for school this afternoon) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC -------------------------------------+------------------------------------- Reporter: aspidites | Owner: monoidal Type: feature | Status: patch request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 Operating System: | hour) Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: Phab:D233 | -------------------------------------+------------------------------------- Comment (by aspidites): Ugh. Got backlogged with school. I'm reading the phabricator documentation right now though. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC -------------------------------------+------------------------------------- Reporter: aspidites | Owner: monoidal Type: feature | Status: patch request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 Operating System: | hour) Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: Phab:D233 | -------------------------------------+------------------------------------- Comment (by hvr): Replying to [comment:12 aspidites]:
Ugh. Got backlogged with school. I'm reading the phabricator documentation right now though.
TLDR: Just head over to Phab:D233 and look through the code. You can comment inline, and don't forget to submit all inline-comments (otherwise they don't become visible for others) when you're done with the form at the very end of that page. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC
-------------------------------------+-------------------------------------
Reporter: aspidites | Owner: monoidal
Type: feature | Status: patch
request | Milestone:
Priority: normal | Version: 7.8.2
Component: Build | Keywords: python
System | Architecture: Unknown/Multiple
Resolution: | Difficulty: Easy (less than 1
Operating System: | hour)
Unknown/Multiple | Blocked By:
Type of failure: | Related Tickets:
None/Unknown |
Test Case: |
Blocking: |
Differential Revisions: Phab:D233 |
-------------------------------------+-------------------------------------
Comment (by Krzysztof Gogolewski

#9184: Allow the use of Python 3 when building GHC -------------------------------------+------------------------------------- Reporter: aspidites | Owner: monoidal Type: feature | Status: closed request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: fixed | Difficulty: Easy (less than 1 Operating System: | hour) Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: Phab:D233 | -------------------------------------+------------------------------------- Changes (by monoidal): * status: patch => closed * resolution: => fixed Comment: I consider this done; I marked the support as "experimental" since I'm not absolutely sure if all code is properly covered and the code will be less used then the P2 version, but once it gets traction and no issues arise, I will remove the mark. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC
-------------------------------------+-------------------------------------
Reporter: aspidites | Owner: monoidal
Type: feature | Status: closed
request | Milestone:
Priority: normal | Version: 7.8.2
Component: Build | Keywords: python
System | Architecture: Unknown/Multiple
Resolution: fixed | Difficulty: Easy (less than 1
Operating System: | hour)
Unknown/Multiple | Blocked By:
Type of failure: | Related Tickets:
None/Unknown |
Test Case: |
Blocking: |
Differential Revisions: Phab:D233 |
-------------------------------------+-------------------------------------
Comment (by Krzysztof Gogolewski

#9184: Allow the use of Python 3 when building GHC -------------------------------------+------------------------------------- Reporter: aspidites | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 Operating System: | hour) Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: Phab:D233 | -------------------------------------+------------------------------------- Changes (by monoidal): * owner: monoidal => * status: closed => new * resolution: fixed => Comment: I reverted this, since it's likely to have broken the Windows build. I will investigate, but it might take some time since I don't have a Windows build set up. I suspect this is caused by the change to `findTFiles`, which previously joined paths with '/', while I changed it to `os.walk` + `os.path.join`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC -------------------------------------+------------------------------------- Reporter: aspidites | Owner: Type: feature | Status: patch request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: | Difficulty: Easy (less than 1 Operating System: | hour) Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: Phab:D310 | -------------------------------------+------------------------------------- Changes (by monoidal): * status: new => patch * differential: Phab:D233 => Phab:D310 Comment: `findTFiles` was indeed the reason for the build failure, resubmitting for review. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC
-------------------------------------+-------------------------------------
Reporter: aspidites | Owner:
Type: feature | Status: patch
request | Milestone:
Priority: normal | Version: 7.8.2
Component: Build | Keywords: python
System | Architecture: Unknown/Multiple
Resolution: | Difficulty: Easy (less than 1
Operating System: | hour)
Unknown/Multiple | Blocked By:
Type of failure: | Related Tickets:
None/Unknown |
Test Case: |
Blocking: |
Differential Revisions: Phab:D310 |
-------------------------------------+-------------------------------------
Comment (by Krzysztof Gogolewski

#9184: Allow the use of Python 3 when building GHC -------------------------------------+------------------------------------- Reporter: aspidites | Owner: Type: feature | Status: closed request | Milestone: Priority: normal | Version: 7.8.2 Component: Build | Keywords: python System | Architecture: Unknown/Multiple Resolution: fixed | Difficulty: Easy (less than 1 Operating System: | hour) Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: Phab:D310 | -------------------------------------+------------------------------------- Changes (by monoidal): * status: patch => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:20 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC
-------------------------------------+-------------------------------------
Reporter: aspidites | Owner:
Type: feature request | Status: closed
Priority: normal | Milestone:
Component: Build System | Version: 7.8.2
Resolution: fixed | Keywords: python
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D310
-------------------------------------+-------------------------------------
Comment (by Herbert Valerio Riedel

#9184: Allow the use of Python 3 when building GHC -------------------------------------+------------------------------------- Reporter: aspidites | Owner: Type: feature request | Status: closed Priority: normal | Milestone: 8.0.1 Component: Build System | Version: 7.8.2 Resolution: fixed | Keywords: python Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D310 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: => 8.0.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:22 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9184: Allow the use of Python 3 when building GHC
-------------------------------------+-------------------------------------
Reporter: aspidites | Owner:
Type: feature request | Status: closed
Priority: normal | Milestone: 8.0.1
Component: Build System | Version: 7.8.2
Resolution: fixed | Keywords: python
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D310
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#9184: Allow the use of Python 3 when building GHC
-------------------------------------+-------------------------------------
Reporter: aspidites | Owner:
Type: feature request | Status: closed
Priority: normal | Milestone: 8.0.1
Component: Build System | Version: 7.8.2
Resolution: fixed | Keywords: python
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D310
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari
= 3.3; silliness!)
Test Plan: Validate on python 3.2 Reviewers: austin Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2778 GHC Trac Issues: #12909, #9184 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9184#comment:24 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC