grimoirelab-perceval icon indicating copy to clipboard operation
grimoirelab-perceval copied to clipboard

windows 10 changed #!/usr/bin/env python3 to #!/usr/bin/env python

Open dereklowlind opened this issue 6 years ago • 12 comments

-changed #!/usr/bin/env python3 to #!/usr/bin/env python so that windows will not error "/usr/bin/env: ‘python3’: No such file or directory" -may cause issues if a user has more than one version of python installed -could make a windows specific copy "pip3 install perceval_windows"

dereklowlind avatar May 10 '19 23:05 dereklowlind

Coverage Status

Coverage remained the same at 97.058% when pulling 9a696626c31339ad12d83645741da11809ca668b on dereklowlind:windows_path_fix into 47209be60f16472e49710f4e3ced7d257d00621f on chaoss:master.

coveralls avatar May 10 '19 23:05 coveralls

Coverage Status

Coverage remained the same at 97.058% when pulling 9a696626c31339ad12d83645741da11809ca668b on dereklowlind:windows_path_fix into 47209be60f16472e49710f4e3ced7d257d00621f on chaoss:master.

coveralls avatar May 10 '19 23:05 coveralls

Thank you @dereklowlind for the PR. I've tested the PR and it works fine, however I'm not sure about the change you propose since #!/usr/bin/env python3 and #!/usr/bin/env python should have different meanings in Linux, and it seems in Windows too (as reported here).

I like the idea of having a perceval for Windows, and it seems reasonable since we have already some issues reported (i.e., https://github.com/chaoss/grimoirelab-perceval/issues/399, https://github.com/chaoss/grimoirelab-perceval/issues/331, https://github.com/chaoss/grimoirelab-perceval/issues/447). However, we have also to keep in mind that perceval is developed on Linux, thus we don't have proper envs (windows 7, 10, ...) to test it and thus we cannot guarantee that perceval_windows will be as good as the Linux version.

@sduenas @jgbarah please share your thoughts, thanks!

valeriocos avatar May 11 '19 09:05 valeriocos

I have packaged my windows "port" and uploaded it to the pip test site and it works installing from the pip command line tool. I added this message to the top of the description "Warning: This is a port to windows in which some features are broken. Please use only to test out the concept and then setup linux and run normal Perceval". Would anyone object to me putting perceval-windows onto the main pip site?

dereklowlind avatar May 24 '19 23:05 dereklowlind

Thank you @dereklowlind for pushing this forward. It's ok for me, but we really need the feedback of @sduenas and @jgbarah.

Btw, where will be located this version of perceval? shouldn't perceval-windows be a repo under chaoss org?

valeriocos avatar May 25 '19 09:05 valeriocos

I did this first port in a forked repo in my personal account (for ease of submitting changes). If the community would like to make it more official then my side project, I would be very happy for it to become a repo of chaoss.org!

dereklowlind avatar May 25 '19 18:05 dereklowlind

Great @dereklowlind! :) It would be really nice if you can join the community and help to maintain perceval-windows.

Please @sduenas, @jgbarah share your thoughts

valeriocos avatar May 25 '19 18:05 valeriocos

Timeline for moving forward on perceval-windows?

dereklowlind avatar Jun 04 '19 22:06 dereklowlind

ping @sduenas @jgbarah

valeriocos avatar Jun 05 '19 05:06 valeriocos

I find it very interesting to have Perceval running in Windows. And as a temporary solution, using perceval-windows as a pip package, could be a good idea. However, a couple of comments:

  • I'm not sure the change from python3 to python is a good idea for non-Windows systems. Probably it is going to become a minor issues as python3 becomes the only python, but I see problems meanwhile, specially when people have both systems installed. I know with virtual environments this is a non-issue, but still... Is there no way of fixing this in Windows in some other way?
  • With respect to the perceval-windows package in pip, which differences would it have? Because right now, perceval is mostly a source package.

jgbarah avatar Jun 05 '19 10:06 jgbarah

I agree it would be great to have Perceval running on Windows. I don't see the solution you propose in this PR the best one, though. It will break how it works in Linux systems now.

One of the possible solutions that might work would be to install a different script depending the OS. A BAT file (or similar) for Windows and the Python file for Unix systems.

Some parts of the code should be adapted to support multi-platform. We can also have tests for both environments in Travis.

sduenas avatar Jun 05 '19 11:06 sduenas

How about using the unspecified python version, checking if it is acceptable, then if not finding the highest version available on the system? I have not checked if the code below works.

https://unix.stackexchange.com/questions/66210/how-can-i-have-more-than-one-possibility-in-a-scripts-shebang-line

#!/usr/bin/env python import os, sys

pythons = [ '/usr/bin/python2.3','/usr/bin/python2.4', '/usr/bin/python2.5', '/usr/bin/python2.6', '/usr/bin/python2.7' ] py = list(filter( os.path.isfile, pythons )) if py: py = py.pop() thepy = int( py[-3:-2] + py[-1:] ) mypy = int( ''.join( map(str, sys.version_info[0:2]) ) ) if thepy > mypy: print("moving versions to "+py) args = sys.argv args.insert( 0, sys.argv[0] ) os.execv( py, args )

print("do normal stuff")

dereklowlind avatar Jun 06 '19 05:06 dereklowlind

Closing this ticket because we don't support Windows in GrimoireLab. Feel free to submit another one in the case you find the way to fix this issue and other windows related issues.

sduenas avatar Oct 13 '23 09:10 sduenas