Package: sealang
Sealang is an improved set of Python bindings forlibclang.The upstream maintainers oflibclanghave not been especially responsive
to patches that address issues like Python 3 compatibility, and the
significant omissions in the API (such as extracting literals and operators).This package is a fork of the official Python bindings forlibclang, patched to correct these problems.InstallationTo compile Sealang, you’ll need to:Install LLVM (with clang)Set some environment variablesInstall SealangThe exact commands needed will vary between platforms.OS XAlthough OS X provides Clang, it doesn’t provide all the development headers,
so you’ll need to .Homebrewis the easiest way to do this. Follow the
installation instructions on the Homebrew homepage; once you’ve got Homebrew
installed, you can run:$ brew install llvm --with-clang --with-asanto get a working install of llvm with clang.Then, you’ll need to set the following environment variables:$ export LLVM_HOME=/usr/local/opt/llvm
$ export DYLD_LIBRARY_PATH=$LLVM_HOME/libLastly, you can install Sealang:$ pip install sealangUbuntu 14.04 (Trusty)To compile under Ubuntu 14.04 (Trusty), you’ll need to get an updated version
of LLVM:$ sudo apt-get install libclang-3.6 clang-3.6 -yThen, you’ll need to set the following environment variables:$ export LLVM_HOME=/usr/lib/llvm-3.6
$ export LD_LIBRARY_PATH=$LLVM_HOME/libLastly, you can install Sealang:$ pip install sealangOther platformsThe instructions for installing on other platforms should be analogous. If you
develop build instructions for a platform, pleasesubmit a pull request.UsageSealang provides a superset of the functionality provided bylibclang. Those features are:Cursorobjects have 4 additional attributes:literal- the value of a literal expression. Available on
IntegerLiteral, FloatingLiteral, StringLiteral, CharacterLiteral, and
CXXBooleanLiteral nodes.operator- the printable version of an operator. Only available on
BinaryOperator, UnaryOperator, and CompoundAssignOperator cursor nodes.binary_operator- an enumeration value describing a BinaryOperator or
CompoundAssignOperator node.unary_operator- an enumeration value describing a UnaryOperator node.BinaryOperator- An enumeration for the types of binary operators:BinaryOperator.INVALIDBinaryOperator.PTRMEMDBinaryOperator.PTRMEMIBinaryOperator.MULBinaryOperator.DIVBinaryOperator.REMBinaryOperator.ADDBinaryOperator.SUBBinaryOperator.SHLBinaryOperator.SHRBinaryOperator.LTBinaryOperator.GTBinaryOperator.LEBinaryOperator.GEBinaryOperator.EQBinaryOperator.NEBinaryOperator.ANDBinaryOperator.XORBinaryOperator.ORBinaryOperator.LANDBinaryOperator.LORBinaryOperator.ASSIGNBinaryOperator.MULASSIGNBinaryOperator.DIVASSIGNBinaryOperator.REMASSIGNBinaryOperator.ADDASSIGNBinaryOperator.SUBASSIGNBinaryOperator.SHLASSIGNBinaryOperator.SHRASSIGNBinaryOperator.ANDASSIGNBinaryOperator.XORASSIGNBinaryOperator.ORASSIGNBinaryOperator.COMMABinaryOperator.UNKNOWNUnaryOperator- An enumeration for the types of binary operators:UnaryOperator.INVALIDUnaryOperator.POSTINCUnaryOperator.POSTDECUnaryOperator.PREINCUnaryOperator.PREDECUnaryOperator.ADDROFUnaryOperator.DEREFUnaryOperator.PLUSUnaryOperator.MINUSUnaryOperator.NOTUnaryOperator.LNOTUnaryOperator.REALUnaryOperator.IMAGUnaryOperator.EXTENSIONUnaryOperator.UNKNOWNHow it worksSealang is a bit of a nasty hack.libclangis a set of C bindings to a C++
API; Pythonctypesare then used to wrap the C API. However, while the C++
API is quite rich,libclangis less so.Sealang bridges this gap by providing C wrappers around the C++ calls that
provide the useful functionality. This library of C functions is wrapped up as
a Python C module for delivery purposes - this C module contains no exposedPythonobjects or methods, but because it’s a module, the underlying
compiledsealang.sofile is easy to find.ctypesare then used to expose
thesealangwrapper functions;Internally, Sealang reproduces some minor pieces of thelibclangAPI;
these are methods (such as the string creation and manipulation methods) that
aren’t exposed as symbols for third-party use.All this functionality is potentially a candidate to be passed upstream to
libclang.Relationship to ClangThis project aims to mirror what is currently available in the Python bindings
tolibclang. The version number for this project is drawn from the version
and SVN revision of the official clang repository.Any changes made upstream tolibclangwill be mirrored here; any changes
made here will, where possible, be pushed upstream tolibclang.CommunitySealang is part of theBeeWare suite. You can talk to the community through:@pybeeware on TwitterTheBeeWare Users Mailing list, for questions about how to use the
BeeWare suite.TheBeeWare Developers Mailing list, for discussing the development of
new features in the BeeWare suite, and ideas for new tools for the suite.ContributingIf you experience problems with Sealang,log them on GitHub. If you
want to contribute code, pleasefork the codeandsubmit a pull request.