Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Running when Python 3 is the default #21

Closed
kokes opened this issue Jan 4, 2017 · 5 comments
Closed

Running when Python 3 is the default #21

kokes opened this issue Jan 4, 2017 · 5 comments

Comments

@kokes
Copy link

kokes commented Jan 4, 2017

It doesn't take much to make grumpy work under a non-default installation of 2.7, so I thought it could be somehow supported or at least described in the README.

I have Python 3 as my default (as in, python or /usr/bin/env python will invoke Python 3), but I do have python2.7 installed as well. I presume this is a setup common for a lot of people, so I thought grumpy could be supported on system configurations like this.

There are only two changes needed:

  • in the Makefile, all calls to @python need to be @python2.7 - but to make this universal, the invocation of python here could be parametrised by using a variable, so that one could set the python version of choice in the Makefile header.
  • tools/* use #!/usr/bin/env python, which will point to Python 3, so I had to change this to /usr/bin/env python2.7 and I'm not quite sure what's the best way to make this parametrised. Perhaps using the aforementioned variable and using find/replace when copying the tool scripts to the build folder

I hardcoded these two changes and tested it out, worked like a charm.

@trotterdylan
Copy link
Contributor

Does anybody have a sense whether the name python2.7 is always available when Python 2.7 is installed? Or are there some installs where it's only installed under python. On both my MacBook and my Ubuntu workstation python2.7 is available. Does it seem reasonable just to hardcode the name python2.7 in the Makefile and shebang lines?

@S-YOU
Copy link
Contributor

S-YOU commented Jan 10, 2017

Not specific to python2.7 but python2
Related to PEP 394 - https://www.python.org/dev/peps/pep-0394/
and v2.7.12 implements that - https://hg.python.org/cpython/raw-file/v2.7.12/Misc/NEWS

@S-YOU
Copy link
Contributor

S-YOU commented Jan 10, 2017

You may interest this - http://stackoverflow.com/a/26056481

@trotterdylan
Copy link
Contributor

I created #88 to address this. Comments welcome.

@trotterdylan
Copy link
Contributor

@kokes Thanks for the suggestions! I implemented it basically as you described. Let me know if you encounter any issues with it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants