<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">From the command line, set
      LD_LIBRARY_PATH to where your compiled LLVM/Clang libraries
      (libclang.so) are. Then, try to run the unit tests:<br>
      <br>
      $ LD_LIBRARY_PATH=/usr/local/lib nosetests -v
      /home/gps/llvm/tools/clang/bindings/python<br>
      <br>
      If that works, then the libclang shared library being loaded isn't
      the right one. You should seek out and destroy references to the
      old version. If that doesn't work, you need to recompile a fresh
      source pull of LLVM/Clang and load that libclang.<br>
      <br>
      Gregory<br>
      <br>
      On 7/12/12 5:52 PM, Carlos Andrade wrote:<br>
    </div>
    <blockquote
cite="mid:CA+KzQ4EzmCYrTPBLWY6x8VBAMZ8rHcHjJ786W6dcMKB86DvW5A@mail.gmail.com"
      type="cite">Sorry I guess I lost you on this one. Where can I
      change this variable?
      <div><br>
      </div>
      <div>I am currently setting this on my ~/.profile</div>
      <div><br>
      </div>
      <div>
        <div>PYTHONPATH="/Users/carlosandrade/Desktop/llvm/tools/clang/bindings/python:$PYTHONPATH"</div>
        <div>export PYTHONPATH</div>
        <div><br>
        </div>
        <div>I only found on read me file after running grep this:</div>
        <div><br>
        </div>
        <div>
          <div>$ env PYTHONPATH=$(echo
            ~/llvm/tools/clang/bindings/python/) \</div>
          <div>      LD_LIBRARY_PATH=$(llvm-config --libdir) \</div>
          <div>  nosetests -v</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>But I am a little clueless on how to go about this!</div>
        <div><br>
        </div>
        <div>Thanks,</div>
        <div><br>
        </div>
        <br clear="all">
        Carlos Andrade<br>
        <div><a moz-do-not-send="true" href="http://carlosandrade.co"
            target="_blank">http://carlosandrade.co</a></div>
        <br>
        <br>
        <br>
        <div class="gmail_quote">2012/7/12 Gregory Szorc <span
            dir="ltr"><<a moz-do-not-send="true"
              href="mailto:gregory.szorc@gmail.com" target="_blank">gregory.szorc@gmail.com</a>></span><br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div>I just ran the most recent Python bindings on my OS X
                build and it works fine.<br>
                <br>
                I suspect an older libclang is being loaded by the
                Python bindings. Try:<br>
                <br>
                LD_LIBRARY_PATH=/path/to/llvm/lib python<br>
                <br>
                You may also want to debug the library loading code and
                ensure the proper path is being picked up. You can
                always through a print statement in there or something.<span
                  class="HOEnZb"><font color="#888888"><br>
                    <br>
                    Gregory</font></span>
                <div>
                  <div class="h5"><br>
                    <br>
                    On 7/12/12 5:25 PM, Carlos Andrade wrote:<br>
                  </div>
                </div>
              </div>
              <div>
                <div class="h5">
                  <blockquote type="cite">Hi,
                    <div><br>
                    </div>
                    <div>I was using the old version of lib clang python
                      interface and have been following up on this. I
                      checked llvm, clang and the compiler as
                      recommended on the get started of the clang
                      webpage (<a moz-do-not-send="true"
                        href="http://clang.llvm.org/get_started.html"
                        target="_blank">http://clang.llvm.org/get_started.html</a>).

                      After changing the python path to the new build I
                      am now getting an error while trying to run the
                      code. </div>
                    <div><br>
                    </div>
                    <div>
                      <div>Traceback (most recent call last):</div>
                      <div>  File "aura.py", line 7, in <module></div>
                      <div>    import clang.cindex</div>
                      <div>  File
                        "/Users/carlosandrade/Desktop/llvm/tools/clang/bindings/python/clang/cindex.py",

                        line 2816, in <module></div>
                      <div>    register_functions(lib)</div>
                      <div>  File
                        "/Users/carlosandrade/Desktop/llvm/tools/clang/bindings/python/clang/cindex.py",

                        line 2407, in register_functions</div>
                      <div>   
                        lib.clang_CompilationDatabase_dispose.argtypes =
                        [c_object_p]</div>
                      <div>  File
                        "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py",

                        line 378, in __getattr__</div>
                      <div>    func = self.__getitem__(name)</div>
                      <div>  File
                        "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py",

                        line 383, in __getitem__</div>
                      <div>    func = self._FuncPtr((name_or_ordinal,
                        self))</div>
                      <div>AttributeError: dlsym(0x1003b21b0,
                        clang_CompilationDatabase_dispose): symbol not
                        found</div>
                    </div>
                    <div><br>
                    </div>
                    <div>
                      <div><br>
                      </div>
                      <div>Does anyone know what is that?</div>
                      <div><br>
                      </div>
                      <div>Thanks,</div>
                      <div><br>
                      </div>
                      <br clear="all">
                      Carlos Andrade<br>
                      <div><a moz-do-not-send="true"
                          href="http://carlosandrade.co" target="_blank">http://carlosandrade.co</a></div>
                      <br>
                      <br>
                      <br>
                      <div class="gmail_quote">2012/7/11 Manuel Klimek <span
                          dir="ltr"><<a moz-do-not-send="true"
                            href="mailto:klimek@google.com"
                            target="_blank">klimek@google.com</a>></span><br>
                        <blockquote class="gmail_quote" style="margin:0
                          0 0 .8ex;border-left:1px #ccc
                          solid;padding-left:1ex">
                          <div>
                            <div>On Tue, Jul 10, 2012 at 3:27 PM, Manuel
                              Klimek <<a moz-do-not-send="true"
                                href="mailto:klimek@google.com"
                                target="_blank">klimek@google.com</a>>
                              wrote:<br>
                              > On Mon, Jul 9, 2012 at 8:13 AM,
                              Gregory Szorc <<a
                                moz-do-not-send="true"
                                href="mailto:gregory.szorc@gmail.com"
                                target="_blank">gregory.szorc@gmail.com</a>>

                              wrote:<br>
                              >> On 7/1/12 11:48 PM, Manuel Klimek
                              wrote:<br>
                              >><br>
                              >> +        lib.clang_tokenize(tu,
                              extent, byref(tokens_memory),<br>
                              >> +              
                               byref(tokens_count))<br>
                              >><br>
                              >> Strange indent. Hm, after reading
                              further I see that that kind of indent is<br>
                              >> quite common. Is there a
                              guideline for how to indent this?<br>
                              >><br>
                              >> It appears my editor is indenting
                              8 spaces when wrapping lines. I'm pretty<br>
                              >> sure that's provided by a popular
                              "macro" settings file to handle Python.<br>
                              >> I'll change it to 4 spaces, as
                              that seems more conventional.<br>
                              >><br>
                              >><br>
                              >><br>
                              >> --- /dev/null<br>
                              >> +++
                              b/bindings/python/clang/enumerations.py<br>
                              >><br>
                              >> +TokenKinds = [<br>
                              >> +    ('PUNCTUATION', 0),<br>
                              >> +    ('KEYWORD', 1),<br>
                              >> +    ('IDENTIFIER', 2),<br>
                              >> +    ('LITERAL', 3),<br>
                              >> +    ('COMMENT', 4),<br>
                              >> +]<br>
                              >><br>
                              >> This doesn't seem to match the
                              comment. Those "TokenKinds" are different<br>
                              >> from what I see in
                              clang/Basic/TokenKinds.def. Am I missing
                              something?<br>
                              >><br>
                              >> What doesn't match the comment?<br>
                              >><br>
                              >> Also, these come from<br>
                              >> <a moz-do-not-send="true"
href="http://clang.llvm.org/doxygen/group__CINDEX__LEX.html#gaf63e37eee4280e2c039829af24bbc201"
                                target="_blank">http://clang.llvm.org/doxygen/group__CINDEX__LEX.html#gaf63e37eee4280e2c039829af24bbc201</a>,<br>
                              >> not the low-level tokens from
                              TokenKinds.def.<br>
                              ><br>
                              > Oh, wow. Can you add a comment on
                              where these TokenKinds come from.<br>
                              > With the overloaded meaning it's
                              really confusing.<br>
                              <br>
                            </div>
                          </div>
                          And apart from that lgtm.<br>
                          <div>
                            <div><br>
                              ><br>
                              > Thanks!<br>
                              > /Manuel<br>
                              ><br>
                              >><br>
                              >><br>
                              >> On Sat, Jun 30, 2012 at 4:16 AM,
                              Gregory Szorc <<a
                                moz-do-not-send="true"
                                href="mailto:gregory.szorc@gmail.com"
                                target="_blank">gregory.szorc@gmail.com</a>><br>
                              >> wrote:<br>
                              >>><br>
                              >>> Updated patch attached.<br>
                              >>><br>
                              >>> * Added Cursor.get_tokens()<br>
                              >>> * Refactored TokenGroup out
                              of TranslationUnit to support above<br>
                              >>> * Refactored with
                              TranslationUnit.get_* API changes from
                              last patch.<br>
                              >>><br>
                              >>> On Fri, Jun 29, 2012 at 12:18
                              AM, Gregory Szorc <<a
                                moz-do-not-send="true"
                                href="mailto:gregory.szorc@gmail.com"
                                target="_blank">gregory.szorc@gmail.com</a>><br>
                              >>> wrote:<br>
                              >>> > This exposes all of
                              libclang's token functions in the Python
                              bindings.<br>
                              >>> ><br>
                              >>> > I'm putting the
                              TokenKind enumerations in a new module,<br>
                              >>> > clang.enumerations. I
                              plan to eventually move all existing<br>
                              >>> > enumerations there so
                              they are all consolidated. And, maybe one
                              day,<br>
                              >>> > we can even generate
                              that file automatically by parsing the
                              libclang<br>
                              >>> > header files. I know
                              Anders has code around somewhere that does<br>
                              >>> > this...<br>
                              >>> ><br>
                              >>> > ---<br>
                              >>> >
                               bindings/python/clang/cindex.py          
                                       | 177<br>
                              >>> > +++++++++++++++++++--<br>
                              >>> >
                               bindings/python/clang/enumerations.py    
                                       |  32 ++++<br>
                              >>> >
                               bindings/python/tests/cindex/test_token_kind.py
                                 |  43 +++++<br>
                              >>> >
                               bindings/python/tests/cindex/test_tokens.py
                                     |  52 ++++++<br>
                              >>> >
                               .../python/tests/cindex/test_translation_unit.py
                                |  24 ++-<br>
                              >>> >  5 files changed, 312
                              insertions(+), 16 deletions(-)<br>
                              >>> >  create mode 100644
                              bindings/python/clang/enumerations.py<br>
                              >>> >  create mode 100644
                              bindings/python/tests/cindex/test_token_kind.py<br>
                              >>> >  create mode 100644
                              bindings/python/tests/cindex/test_tokens.py<br>
                              >>><br>
                              >>>
                              _______________________________________________<br>
                              >>> cfe-commits mailing list<br>
                              >>> <a moz-do-not-send="true"
                                href="mailto:cfe-commits@cs.uiuc.edu"
                                target="_blank">cfe-commits@cs.uiuc.edu</a><br>
                              >>> <a moz-do-not-send="true"
                                href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits"
                                target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
                              >>><br>
                              >><br>
                              >><br>
                            </div>
                          </div>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>