pylint #99139 Compability with different python flavours [validation pending]
I would really appreciate if pylint could be run from jython or other python flavours, for this several adjustments are necessary, the first two I encountered are: After trying to run pylint from jython I got an errormessage of the following form: Traceback (most recent call last): File "", line 1, in File "jython2.7a2/Lib/site-packages/pylint/lint.py", line 31, in from pylint.checkers import utils File "jython2.7a2/Lib/site-packages/pylint/checkers/__init__.py", line 44, in from logilab.astng.utils import ASTWalker File "jython2.7a2/Lib/site-packages/logilab/astng/__init__.py", line 58, in from logilab.astng.nodes import * File "jython2.7a2/Lib/site-packages/logilab/astng/nodes.py", line 50, in from logilab.astng.scoped_nodes import Module, GenExpr, Lambda, DictComp, \ File "jython2.7a2/Lib/site-packages/logilab/astng/scoped_nodes.py", line 45, in from logilab.astng.manager import ASTNGManager File "jython2.7a2/Lib/site-packages/logilab/astng/manager.py", line 31, in from logilab.common.modutils import NoSourceFile, is_python_source, \ File "jython2.7a2/Lib/site-packages/logilab/common/modutils.py", line 61, in STD_LIB_DIR = join(get_config_var("LIBDIR"), "python%s" % get_python_version()) File "jython2.7a2/Lib/posixpath.py", line 62, in join elif path == '' or path.endswith('/'): AttributeError: 'NoneType' object has no attribute 'endswith'I could overcome this by changing the behaviour of jython, however I have been led to believe that the error comes from somewhere else inside pylint or its libraries: http://bugs.jython.org/issue1937 Furthermore you use __builtins__ in your code, however this is an implementation detail, as stated here: http://bugs.jython.org/issue1938 you should use __builtin__ instead (notice the missing 's'. File "/jython2.7a2/Lib/site-packages/pylint/checkers/utils.py", line 97, in builtins = __builtins__.copy() NameError: name '__builtins__' is not definedI would really appreciate it, if I could use pylint with jython. | |
priority | important |
---|---|
type | bug |
done in | 0.25.2 |
load left | 0.000 |
closed by | #0fc805bbfbe3 Fix checkers.utils for other implementations (use of __builtins__). Closes #99139. Closes #89838. Theses fixes need fixes on logilab-astng and logilab-common |
Comments
-
2012/07/02 07:25, written by malte.vesper
-
2012/07/05 18:57, written by bpedman
-
2012/07/16 08:09, written by malte.vesper
-
2012/07/17 08:14, written by sthenault
-
2012/07/18 08:10, written by malte.vesper
I still see the 'NoneType' has no attribute 'endswith' error (first in the post), workarround would be to call the function with YourVariable or '' to patch what I suggested in my jython fix request (http://bugs.jython.org/issue1937).
if I work arround that by hacking the posixlib I get this (with the latest and greatest astng (hg pull and hg update, running setup.py install thereafter)
-
2012/07/18 08:50, written by sthenault
-
2012/07/20 13:03, written by anon
-
2012/07/20 13:05, written by malte.vesper
-
2012/07/20 13:21, written by sthenault
-
2012/07/23 07:38, written by malte.vesper
-
2012/07/23 09:18, written by sthenault
-
2012/07/23 12:44, written by malte.vesper
the good news: thank you very much i just ran hg pull, after deleting the checkouts. Turned out hg common was not up to date.
the bad news:
Simply dropping the s (line 711 and 713 results in another not defined error. Seems there is another location where something hast ob e done with builtin
(after attempted fix (dropping "s"):
If you could please hang in there, I really appreciate your help and helping me even though my skills with hg are lacking, I hope I did not cause to much trouble and apologize.
-
2012/07/24 06:19, written by sthenault
-
2012/07/24 08:14, written by malte.vesper
ok i cloned from the stated repository and ran an install, first off I noticed that it reports pylint 0.25.1 during install.
After I still ran into an error I checked the file and noticed that line 711 is unchanged. (Still builtins) but maybe you created a definition elsewhere.
The error changed its look slightly, I now get this:
(notice the already importet warning in the beginning)
-
2012/07/31 14:19, written by malte.vesper
add commentThis partly(!) referrs to this: https://www.logilab.org/ticket/89838
I would also like to have support for Jython
Hi, where can I get the latest and greatest version? I just did a checkout with hg and still run into both issues, are the patches not applied once they have been reviewed or have I messed up somewhere (do I need to uninstall teh old version first, apply the patches manually,...?)
Thank you for fixing it anyhow, I hope to see the beauty at work once I figure out where I turned wrong. Is there a way arround applying all patches manually?
patches have now been applied (there is one remaining in logilab.common.modutils but that should'nt hurt jython I think), so please pull and test !
The first error should be fixed in logilab-common #tip (to be released today, along with pylint and astng).
The traceback should now be fixed in astng #tip as well, thank you for noticing it.
my mercurial knowledege is low, I tried "hg pull" & "hg update" / "hg pull -r tip" & "hg update" and reinstalled where changes were indicated. Am I missing something or should I just make a clean clone?
I tried with both of "hg pull"/"hg pull -r tip" followed by "hg update". Am I missing something or should I just make a new clone?
I think I am not seeing all of your work.
I will retry on monday
from which repositories are you pulling?
As you may know, I've released logilab.common, ASTNG and pylint earlier this week. If you don't see the release tags in their respective repository (try installing hgview! http://www.logilab.org/project/hgview or simply use hg log), you're probably missing something.
I cleared the files from my jython directory and made fresh check outs and installed everything a fresh and still see the first error. hg log states:
***@ubuntu:~/pylintHG/pylint$ hg log -l1
changeset: 817:8714a7bdc1f4
tag: tip
user: Sylvain Thénault <sylvain.thenault@logilab.fr>
date: Wed Jul 18 08:34:40 2012 +0200
summary: Added tag pylint-debian-version-0.25.2-1 for changeset 1b744fb874a2
***@ubuntu:~/pylintHG/common$ hg log -l1
changeset: 1491:8724116a446a
branch: stable
tag: tip
user: Sylvain Thénault <sylvain.thenault@logilab.fr>
date: Tue Jul 17 17:10:51 2012 +0200
summary: fix debian rev
***@ubuntu:~/pylintHG/astng$ hg log -l1
changeset: 976:8d418c9894ef
tag: tip
user: Sylvain Thénault <sylvain.thenault@logilab.fr>
date: Wed Jul 18 11:30:01 2012 +0200
summary: Added tag logilab-astng-debian-version-0.24.0-1 for changeset d517d5a9bac9
after pulling all I installed common, astng, pylint in the order just stateted by running:
sudo myJythonInstall setup.py install
afterwards I tested using:
myJythonInstall
>>> import pylint.lint
and got the first error from the original ticket (no endswith attribute for None)
Anything else I can try/further information you need?
p.s. testing on xubuntu (ubuntu 12.04), fully patched with Jython 2.7a2
oh and I am pulling from the repositories given under the sourcecode tab here on logilab for each project
so you have proper revisions in your repositories. Are you on tip on each project? Are you sure you ends up in the modutils module from the hg checkout (ie not a python path pb) ?
malte, don't apologize for helping us making pylint better :)
So it seems compat hasn't been tested all the path long. I've pushed a fix for this, can you "hg pull -u"from http://hg-lab.logilab.org/review/pylint and try again ?
Hi, I just pulled again. Now it is working.
(The already imported warning remains but it runs)
Thank you very much.
There would be some benefits that could improve Jython support. (Not crashing on Java imports)
but I will play arround with pylint for a while, and determine what i would think off as usefull steps and open a new ticket.
This is resolved. Thanks again for your work sthenault.
Malte