Syncplay / syncplay

Client/server to synchronize media playback on mpv/VLC/MPC-HC/MPC-BE on many computers
http://syncplay.pl/
Apache License 2.0
2.09k stars 213 forks source link

python version disambiguation #28

Closed blaenk closed 10 years ago

blaenk commented 10 years ago

Hey, it's me again.

I'm trying to package this up for a system where python is python 3. There's python2 on this system, so what I'm currently doing is running sed to replace the hashbangs from /usr/bin/env python to /usr/bin/env python2. I don't know if you guys could do this in the source itself; I don't know if other systems have python2, if not that, then perhaps they do have python2.7?

Another hurdle is that you guys have lines like these in the makefile:

echo '#!/bin/sh\npython -OO $(LIB_PATH)/syncplay/syncplayClient.py "$$@"' > $(BIN_PATH)/syncplay

I'm not quite sure why you guys are prepending this line, since the affected files already have the #!/usr/bin/env python hashbang? The problem these lines pose is the package I'm creating runs sed to change the hashbang to use python2 instead of just python, but then the makefile goes and replaces the hashbang yet again, overwriting my the sed fix.

Anyways, these are the problems I'm facing right now, and I'm wondering what you guys think about them, if you can propose any ideas for solving them. The makefile lines I mentioned seem unnecessary to me, but perhaps you guys have good reasons.

Uriziel commented 10 years ago

Hi,

Rather the reason for it to be there it's lack of experience. :]

You're right, we probably should make a script with checks for python2.7 and python2 binaries before it executes python.

So yeah, we'll look into it.

blaenk commented 10 years ago

Ah okay, no problem!

I just asked on #python and I was told that python2.7 nor python2 are widely available, so it's not good to rely on them.

What I have seen other packages do on this system (archlinux) is to simply use a sed command like I'm doing right now to replace the hashbangs to use python2. It's actually a very simple thing to do. So my recommendation would be to keep it as is, since it's predictable, but just get rid of the makefile lines 43 and 62, which replace the hashbangs. Once that's done, considering this system seems to be the exception, I can handle this on my end perfectly fine!

blaenk commented 10 years ago

It seems to me like the best option would be to adopt something like what pygments does. I'll look into it.

blaenk commented 10 years ago

Actually I think it might be simpler to just use site.addsitedir from the site module towards the top of the binaries.