build: python 3 compatibility #7723

pull laanwj wants to merge 1 commits into bitcoin:master from laanwj:2016_03_build_python_3 changing 11 files +135 −129
  1. laanwj commented at 6:00 PM on March 20, 2016: member

    Ubuntu 16.04 "xenial xerus" does not come with Python 2.x by default. It is possible to install a python-2.7 package, but this has its own problem: no python or python2 symlink (see #7717).

    This fixes the following scripts to work with python 3:

    • make check (bctest,py, bitcoin-util-test.py)
    • make translate (extract_strings_qt.py)
    • make symbols-check (symbol-check.py)
    • make security-check (security-check.py)
    • make deploy for OS X (custom_dsstore.py, macdeployqtplus)

    Explicitly call the python commands using $(PYTHON) (detected by autoconf) instead of relying on the interpreter line at the top of the scripts.

    Python 2.x compatibility should be unaffected. For the build system I think it's good to have both Python2 and Python3 compatibility. This is not necessary for the other python scripts, such as the RPC tests. For practical reasons it's ok to have an explicit Python 2.7 dependency for those - though we'll have to document that.

  2. laanwj added the label Build system on Mar 20, 2016
  3. laanwj force-pushed on Mar 20, 2016
  4. laanwj force-pushed on Mar 20, 2016
  5. laanwj cross-referenced this on Mar 20, 2016 from issue [qa] Refactor python2 syntax by MarcoFalke
  6. laanwj commented at 11:01 AM on March 21, 2016: member

    Ping @theuni

  7. laanwj cross-referenced this on Mar 21, 2016 from issue Python 3 transition (was: Ubuntu 16.04 python troubles) by laanwj
  8. MarcoFalke commented at 12:19 PM on March 21, 2016: member

    Looks good. Concept ACK 40a9d86

  9. jonasschnelli commented at 12:45 PM on March 21, 2016: contributor

    Concept ACK.

    Why not use !/usr/bin/env python as interpreter? IMO we should at least remove /usr/bin/python2 and use /usr/bin/python (https://github.com/bitcoin/bitcoin/pull/7723/files#diff-d403511be890783565b1e2d164beec8aR1).

  10. laanwj force-pushed on Mar 21, 2016
  11. laanwj commented at 1:00 PM on March 21, 2016: member

    Why not use !/usr/bin/env python as interpreter?

    Interpeter shouldn't matter anymore because all usages invoke the explicitly located python executable. (could even remove it, in principle)

  12. theuni commented at 4:51 AM on March 22, 2016: member

    @laanwj Aha, clever fix :)

    I'm not well-versed in python2/python3 to comment on the compat there, but concept ack for sure.

    Looks like some of the mac deploy scripts are missing, though:

    contrib/macdeploy/custom_dsstore.py
    contrib/macdeploy/macdeployqtplus
    

    Those both get hit via make deploy

  13. laanwj commented at 7:47 AM on March 23, 2016: member
    contrib/macdeploy/custom_dsstore.py
    contrib/macdeploy/macdeployqtplus
    

    Right, good catch, will have a look at those.

  14. laanwj force-pushed on Mar 23, 2016
  15. laanwj commented at 10:09 AM on March 23, 2016: member

    @cfields see b40e365c2a24019e2b3e2651510874d0cecf2ae3 Works in python2 at least, haven't tested w/ python3 yet, I don't have a macosx dev environment set up.

  16. laanwj commented at 11:43 AM on March 23, 2016: member

    Works in python2 at least, haven't tested w/ python3 yet, I don't have a macosx dev environment set up.

    Ok, tested by temporarily changing the detection to only 'see' python3. It passed.

  17. laanwj force-pushed on Mar 23, 2016
  18. laanwj cross-referenced this on Mar 23, 2016 from issue devtools: make github-merge.py use py3 by laanwj
  19. caraka cross-referenced this on Mar 26, 2016 from issue Build: python 3 compatibility by caraka
  20. in contrib/macdeploy/macdeployqtplus:None in b40e365c2a outdated
     574 | @@ -575,7 +575,7 @@ if len(config.fancy) == 1:
     575 |      if fancy.has_key("background_picture"):
    


    MarcoFalke commented at 3:19 PM on March 28, 2016:

    Nit: there is no has_key in py3


    laanwj commented at 7:22 AM on March 29, 2016:

    Good catch

  21. MarcoFalke commented at 3:20 PM on March 28, 2016: member

    utACK b40e365

  22. build: python 3 compatibility
    Ubuntu 16.04 "xenial xerus" does not come with Python 2.x by default.
    It is possible to install a python-2.7 package, but this has its own
    problem: no `python` or `python2` symlink (see #7717).
    
    This fixes the following scripts to work with python 3:
    - `make check` (bctest,py, bitcoin-util-test.py)
    - `make translate` (extract_strings_qt.py)
    - `make symbols-check` (symbol-check.py)
    - `make security-check` (security-check.py)
    
    Explicitly call the python commands using $(PYTHON) instead
    of relying on the interpreter line at the top of the scripts.
    18f05c765c
  23. laanwj force-pushed on Mar 29, 2016
  24. laanwj commented at 3:21 PM on March 29, 2016: member

    Squashed b875273, b40e365 and cb01698 into 18f05c7

  25. laanwj merged this on Mar 29, 2016
  26. laanwj closed this on Mar 29, 2016

  27. laanwj referenced this in commit 5131005e5b on Mar 29, 2016
  28. laanwj referenced this in commit de0fcd3a99 on Apr 3, 2016
  29. laanwj cross-referenced this on Apr 3, 2016 from issue depends: mac deploy Py3 compatibility (fixes macosx gitian build) by laanwj
  30. laanwj referenced this in commit 4f688682ed on Apr 3, 2016
  31. theuni referenced this in commit 35cbd5f409 on Apr 21, 2016
  32. theuni referenced this in commit d96a9ed0cd on Apr 21, 2016
  33. theuni referenced this in commit a6666b25c7 on Apr 21, 2016
  34. pstratem referenced this in commit 38915ae58e on May 1, 2016
  35. MarcoFalke cross-referenced this on Jun 9, 2016 from issue [0.12.2] backport: [qa] Switch to py3 by MarcoFalke
  36. MarcoFalke cross-referenced this on Jun 26, 2016 from issue Tests: Use portable #! in python scripts (/usr/bin/env) by ChoHag
  37. ChoHag referenced this in commit 7b01ce254c on Jun 28, 2016
  38. MarcoFalke referenced this in commit 6e5e5abba6 on Aug 15, 2016
  39. codablock referenced this in commit 973632091b on Sep 16, 2017
  40. codablock referenced this in commit 14ee19bf89 on Sep 19, 2017
  41. codablock referenced this in commit b4feccfa59 on Sep 19, 2017
  42. codablock referenced this in commit fa48694cab on Dec 9, 2017
  43. codablock referenced this in commit a9a209f586 on Dec 19, 2017
  44. codablock referenced this in commit 1f8ca7546e on Dec 20, 2017
  45. codablock referenced this in commit 542507a32b on Dec 29, 2017
  46. codablock referenced this in commit bc659c3e6e on Jan 8, 2018
  47. lateminer referenced this in commit f6d63b9123 on Jan 12, 2018
  48. sickpig cross-referenced this on Oct 11, 2018 from issue [PORT] build: python 3 compatibility by sickpig
  49. michelvankessel referenced this in commit 0f1f65f9e3 on Jan 4, 2019
  50. andvgal referenced this in commit 7016e131ac on Jan 6, 2019
  51. lateminer referenced this in commit 2178b1cfa7 on Jan 22, 2019
  52. CryptoCentric referenced this in commit 637b0d3d67 on Feb 15, 2019
  53. bitcoin locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:55 UTC