ejwa / gitinspector

:bar_chart: The statistical analysis tool for git repositories
GNU General Public License v3.0
2.36k stars 327 forks source link

Master Branch Does not work with Phython 2.7 after Commint on October 20th #106

Closed mikehogeboom closed 8 years ago

mikehogeboom commented 8 years ago

Hello,

I recently pulled the latest code and I stepped through commit by commit and after the commit on October 20th, there appears to be an issue on Python 2.7

C:\projects\git\myrepo>gitinspector -f java,c,cc,cpp,h,hh,hpp,py,glsl,rb, js,sql,json,groovy,html,properties,xml,gradle,md,story --since=2016-03-01 -F htm l > 2016-03-01-statsb.html Traceback (most recent call last): File "C:\projects\git\gitinspector\gitinspector\gitinspector.py", line 29, in

from . import basedir ValueError: Attempted relative import in non-package The commit just prior everything works smootly. Tip of CI also works. I also attempted on Python 3.4.4 Calling with no command line arguments causes the same issue. I beleive this is the commit that caused the issue: Commit: 9abb9b3d568323ea4216d0286dff7583c6007528 [9abb9b3] Parents: f2a4cb92d3 Thanks, Mike
adam-waldenberg commented 8 years ago

Works fine in both Python 3 and Python 2 here. And yes, there was a major redesign done with this commit.

Are you running it via a python egg? If so, did you reinstall with setup.py ? If you run it directly from the gitinspector directory, there is now a new entry point script that you need to use;

https://github.com/ejwa/gitinspector/blob/master/gitinspector.py

adam-waldenberg commented 8 years ago

To further explain, this was needed in order to better organize the different layers in gitinspector.

mikehogeboom commented 8 years ago

I installed Python using an .msi executable and added it to my path. I was previously was using 3,4,4, but I downgraded to 2.7.11 today just to see if it would help.

Calling it in the directory with or without arguments renders the same results:

C:\projects\git\gitinspector\gitinspector>gitinspector.py Traceback (most recent call last): File "C:\projects\git\gitinspector\gitinspector\gitinspector.py", line 26, in

from .blame import Blame ValueError: Attempted relative import in non-package Should I call something other than gitinspector.py?
adam-waldenberg commented 8 years ago

Yes. You have two options;

  1. Install it as an egg. This way it should work even with the revision where this error occured.
  2. Jump to this revision (or later); https://github.com/ejwa/gitinspector/commit/e9eab37c83b6c4304bc0edb448c321ff5cab6c2c and then execute gitinspector/gitinspector.py instead of gitinspector/gitinspector/gitinspector.py.
mikehogeboom commented 8 years ago

ok, thanks. I'll report back

adam-waldenberg commented 8 years ago

Also, note that the master branch is very much "in the works" and things like the HTML output is currently broken. If you want something stable, stick to the 0.4.x branches.

mikehogeboom commented 8 years ago

ok, good to know. btw, still no luck. I cannot seem to find documentation on how to download python as an egg. I'll as some of my DevOPs guys in the morning.

adam-waldenberg commented 8 years ago

Hi. As you are under windows I'm not completely sure how it behaves... However, normally you just need to run the setup.py script of a python program with;

setup.py install

This is also available with gitinspector. This should install gitinspector as an egg and also generate a global gitinspector command that is available in your path. Note, that this requires python distutils/setuptools or a derivative to be installed on the system.

mikehogeboom commented 8 years ago

Wanted to give an update. I have switched to my Mac and everything works fine (other than the HTML reports you mentioned). I tried numerous things to get it running on Windows. Not sure if other have same issues. I've solved by moving to Mac. I'll leave it up to you if we keep the bug open as I'm not an expert in Python to know if my config is correct, but I tried to stay as close to out of the box as possible on my Windows machine. Thanks for your assistance!

adam-waldenberg commented 8 years ago

Great to hear. I don't think there is an issue, but let's keep this open for a little while anyway.

koppor commented 8 years ago

Same issue here on Win 10. Solution was to switch back to f2a4cb9.

adam-waldenberg commented 8 years ago

That commit is doing a hack by manually adding a path, so it's not a solution. Make sure you are using the right script when starting gitinspector. Use gitinspector.py in the root. Not gitinspector/gitinspectgor.py. This won't work anymore.