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

build: python 3 compatibility #7723

Merged
merged 1 commit into from Mar 29, 2016

Conversation

Projects
None yet
4 participants
@laanwj
Member

laanwj commented Mar 20, 2016

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.

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj
Member

laanwj commented Mar 21, 2016

Ping @theuni

@MarcoFalke

This comment has been minimized.

Show comment
Hide comment
@MarcoFalke

MarcoFalke Mar 21, 2016

Member

Looks good. Concept ACK 40a9d86

Member

MarcoFalke commented Mar 21, 2016

Looks good. Concept ACK 40a9d86

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Mar 21, 2016

Member

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).

Member

jonasschnelli commented Mar 21, 2016

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).

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Mar 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)

Member

laanwj commented Mar 21, 2016

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)

@theuni

This comment has been minimized.

Show comment
Hide comment
@theuni

theuni Mar 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

Member

theuni commented Mar 22, 2016

@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

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Mar 23, 2016

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

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

Member

laanwj commented Mar 23, 2016

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

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

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Mar 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.

Member

laanwj commented Mar 23, 2016

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

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Mar 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.

Member

laanwj commented Mar 23, 2016

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.

@@ -575,7 +575,7 @@ if len(config.fancy) == 1:
if fancy.has_key("background_picture"):

This comment has been minimized.

@MarcoFalke

MarcoFalke Mar 28, 2016

Member

Nit: there is no has_key in py3

@MarcoFalke

MarcoFalke Mar 28, 2016

Member

Nit: there is no has_key in py3

This comment has been minimized.

@laanwj

laanwj Mar 29, 2016

Member

Good catch

@laanwj

laanwj Mar 29, 2016

Member

Good catch

@MarcoFalke

This comment has been minimized.

Show comment
Hide comment
@MarcoFalke

MarcoFalke Mar 28, 2016

Member

utACK b40e365

Member

MarcoFalke commented Mar 28, 2016

utACK b40e365

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.
@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Mar 29, 2016

Member

Squashed b875273, b40e365 and cb01698 into 18f05c7

Member

laanwj commented Mar 29, 2016

Squashed b875273, b40e365 and cb01698 into 18f05c7

@laanwj laanwj merged commit 18f05c7 into bitcoin:master Mar 29, 2016

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

laanwj added a commit that referenced this pull request Mar 29, 2016

Merge #7723: build: python 3 compatibility
18f05c7 build: python 3 compatibility (Wladimir J. van der Laan)

laanwj added a commit to laanwj/bitcoin that referenced this pull request Apr 3, 2016

depends: mac deploy Py3 compatibility
This fixes the gitian MacOSX build, it was broken in #7723.

The patch to `native_mac_alias` should probably make it upstream.

theuni added a commit to theuni/bitcoin that referenced this pull request Apr 21, 2016

depends: mac deploy Py3 compatibility
This fixes the gitian MacOSX build, it was broken in #7723.

The patch to `native_mac_alias` should probably make it upstream.

pstratem added a commit to pstratem/bitcoin that referenced this pull request May 1, 2016

depends: mac deploy Py3 compatibility
This fixes the gitian MacOSX build, it was broken in #7723.

The patch to `native_mac_alias` should probably make it upstream.

ChoHag added a commit to ChoHag/bitcoin that referenced this pull request Jun 28, 2016

MarcoFalke added a commit that referenced this pull request Aug 15, 2016

Merge #8270: Tests: Use portable #! in python scripts (/usr/bin/env)
7b01ce2 Favour python over python2 as per PR #7723 (Matthew King)
873e81f Use portable #! in python scripts (/usr/bin/env) (Matthew King)

codablock added a commit to codablock/dash that referenced this pull request Sep 16, 2017

Merge #7723: build: python 3 compatibility
18f05c7 build: python 3 compatibility (Wladimir J. van der Laan)

codablock added a commit to codablock/dash that referenced this pull request Sep 19, 2017

Merge #7723: build: python 3 compatibility
18f05c7 build: python 3 compatibility (Wladimir J. van der Laan)

codablock added a commit to codablock/dash that referenced this pull request Sep 19, 2017

Merge #8270: Tests: Use portable #! in python scripts (/usr/bin/env)
7b01ce2 Favour python over python2 as per PR #7723 (Matthew King)
873e81f Use portable #! in python scripts (/usr/bin/env) (Matthew King)

codablock added a commit to codablock/dash that referenced this pull request Dec 9, 2017

Merge #7723: build: python 3 compatibility
18f05c7 build: python 3 compatibility (Wladimir J. van der Laan)

codablock added a commit to codablock/dash that referenced this pull request Dec 19, 2017

Merge #7723: build: python 3 compatibility
18f05c7 build: python 3 compatibility (Wladimir J. van der Laan)

codablock added a commit to codablock/dash that referenced this pull request Dec 20, 2017

depends: mac deploy Py3 compatibility
This fixes the gitian MacOSX build, it was broken in #7723.

The patch to `native_mac_alias` should probably make it upstream.

codablock added a commit to codablock/dash that referenced this pull request Dec 29, 2017

Merge #8270: Tests: Use portable #! in python scripts (/usr/bin/env)
7b01ce2 Favour python over python2 as per PR #7723 (Matthew King)
873e81f Use portable #! in python scripts (/usr/bin/env) (Matthew King)

codablock added a commit to codablock/dash that referenced this pull request Jan 8, 2018

Merge #8270: Tests: Use portable #! in python scripts (/usr/bin/env)
7b01ce2 Favour python over python2 as per PR #7723 (Matthew King)
873e81f Use portable #! in python scripts (/usr/bin/env) (Matthew King)

lateminer added a commit to lateminer/bitcoin that referenced this pull request Jan 12, 2018

depends: mac deploy Py3 compatibility
This fixes the gitian MacOSX build, it was broken in #7723.

The patch to `native_mac_alias` should probably make it upstream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment