Giter VIP home page Giter VIP logo

Comments (8)

mhagger avatar mhagger commented on July 28, 2024

python2 is there because git-imerge requires Python version 2.x as opposed to Python 3.x (or, God forbid, Python 1.x). According to PEP 394, it is recommended that some Python 2.x interpreter be installed in PATH under the name "python2". I understand that this is not yet universal practice, but on the other hand there are already systems where "python" is a Python version 3.x interpreter, so that option is also not universally portable.

By the way, I think that any Python interpreter version 2.5 <= version < 3.0 should be fine for git-imerge.

from git-imerge.

myint avatar myint commented on July 28, 2024

I resolved this by supporting both Python 2 and 3. @mhagger, if you are interested, I can either send a pull requests or you can just merge my fork. The continuous integration server shows the test results.

from git-imerge.

mhagger avatar mhagger commented on July 28, 2024

@myint, that's really cool! I hadn't yet had the energy to get any of my projects running under Python3. It's a lot less nasty than I would have feared.

I just pushed some commits to master that incorporate some of the changes from your first commit. The remainder of your changes (i.e., after the already-merged changes have been removed) are in my repo under branch myint/python3. But before I merge the rest, I would like to understand the ramifications a little bit better.

What is the situation on the Mac OSX? (Is that is what you are using?) Is Python 2.x unavailable, or is it available, but just not under the name python2? In other words, are these changes needed to make the script usable under Mac OSX at all, or just to avoid having to edit the shebang line?

(If the latter, then there are other ways to make sure that a Python 2.x interpreter is used to run the script. Either the script can be given a Shell preamble that chooses the correct Python interpreter, or we could add an install script that overwrites the shebang line with the one correct for the system that it is running on. Not that python3 compatibility is something bad, but reducing the python2 compatibility might still be inconvenient for some users.)

Before these changes, I think that git-imerge would have worked under Python versions 2.5 <= version < 3.0 (though I haven't actually tested it against the older versions). The changes I just pushed now prevent it from running under 2.5 (because it doesn't have the next() built-in function). With the rest of your changes, what versions of Python should it run under? Only 2.7 and 3.3? Assuming that is the case, we should probably verify that the important recent OSs make one of these Python versions available.

Thanks again for your contribution!

from git-imerge.

jdelStrother avatar jdelStrother commented on July 28, 2024

Python 2.x comes installed on OS X, as python. OS X 10.9 comes with python 2.7.5. There's no python2 by default

from git-imerge.

myint avatar myint commented on July 28, 2024

Like @jdelStrother mentioned, python2 doesn't exist on OS X. An OS X user could just create a symlink called python2 and point it to /usr/bin/python. I happen to use Python 3 by default so my use case only tangentially relates to this issue (#18).

I've enabled the Python 2.6 test on Travis CI (450e728). It works. See test results here.

I could enable Python 2.5 support, but the code will get a bit uglier. (The as exception syntax, which Python 3 requires, isn't supported in Python 2.5 and there are a few other things like what you mentioned.) And I think the trend in Python now is to support Python 2.6, 2.7, and 3.3.

from git-imerge.

mhagger avatar mhagger commented on July 28, 2024

@myint: Thanks for the additional info. I was confused; I thought that "except E as T" syntax wasn't added until Python 2.7. Now I see that it was backported to Python 2.6.1.

So if we merge your changes, I think our Python version requirement would become

(2.6.1 <= version < 3.0) or (3.3 <= version)

(that is, unless something else that you are using was introduced even later than 2.6.1). I think we can live with that. I just merged your change (though the commit identities have changed, so you might want to pull from me again).

Thanks!

from git-imerge.

myint avatar myint commented on July 28, 2024

Great! By the way, as far as I know the as exception syntax was introduced in Python 2.6 proper. The 2.6.1 change log mentions it too, but only because the change log is cumulative. (I don't think Python developers introduce syntax changes in patch releases.)

from git-imerge.

mhagger avatar mhagger commented on July 28, 2024

@myint: I was going by the language reference for 2.6 vs 2.6.1. The as syntax wasn't mentioned until 2.6.1. But given that it is mentioned in the changelog for 2.6, I assume that it was implemented then and they just didn't get around to updating the language reference in time for the release.

I'll fix the README.

from git-imerge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.