summaryrefslogtreecommitdiff
path: root/giscanner
Commit message (Collapse)AuthorAgeFilesLines
* scanner: fix cachestore raceDieter Verfaillie2015-07-051-9/+8
| | | | | | | | Using tempfile.mkstemp should prevent the temp file from being cleaned while it might still be used by another process. https://bugzilla.gnome.org/show_bug.cgi?id=751926
* tests: Update misc/pep8.py to 1.6.2Dieter Verfaillie2015-06-297-20/+14
| | | | | Updated from: https://raw.githubusercontent.com/jcrocholl/pep8/1.6.2/pep8.py
* scanner: remove unused importsDieter Verfaillie2015-06-292-7/+1
|
* scanner: remove unused param_namesDieter Verfaillie2015-06-291-2/+0
| | | | | | we haven't been emitting the warning for about six years (see 7dbbda9abea9882d2c98726f382a905fa8738706) so remove the leftovers...
* scanner: fix broken assert messageDieter Verfaillie2015-06-291-1/+1
| | | | | | | | 288b339edf262f1dba4e87a9faef46cc79749bd5 changed the signature from def _parse_type_second_pass(self, parent, node, typeval): to def _parse_type_array_length(self, siblings, node, typeval) but failed to change the assert statement accordingly.
* scanner: document LibtoolImporter.load_module()Dieter Verfaillie2015-06-291-9/+6
| | | | | | | | | | | | | | | | | | It was reported by HeBD on #introspection that Python modules use the .pyd extension on windows, not .dll. The simple fix would have been to just rename to .pyd, but we started investigating the possibility of acquiring the suffix tuple(s) via imp.get_suffixes() instead. Which led to the discovery that imp.load_module() simply ignores the first item of said tuple. Thus, there is no use in pretending it to be of any importance in this case so we set it to an empty string. imp_load_module() source for: Python 2.6.9 : https://hg.python.org/cpython/file/fcb3ec2842f9/Python/import.c#l3021 Python 2.7.10: https://hg.python.org/cpython/file/15c95b7d81dc/Python/import.c#l3148 and just to be future-proof: Python 3.4.3 : https://hg.python.org/cpython/file/b4cbecbc0781/Lib/imp.py#l220
* scanner: future-proof cachestore version hashingDieter Verfaillie2015-06-291-2/+1
| | | | | | | Python 3 does not write .pyc files like Python 2 used to do but instead put's them in a __pycache__ directory. Simply compute the version hash using the .py files instead.
* scanner: centralize caret error message handlingDieter Verfaillie2015-06-242-105/+77
| | | | | | | Not doing this manually all over the place makes the code slightly more readable. https://bugzilla.gnome.org/show_bug.cgi?id=689454
* tests: sync with GTK-Doc test suite @ ↵Dieter Verfaillie2015-06-241-5/+2
| | | | | | 02e545371e2132a97458888895cacf57b8c0f83a (2015-06-23) https://bugzilla.gnome.org/show_bug.cgi?id=725685
* scanner: disable cache in reparse validate modeDieter Verfaillie2015-06-241-1/+1
| | | | | | | | | | | | Only types are stored in the cache store, so disable the cache for reparse validate mode since it needs access to the whole serialized tree. This fixes a seemingly hard to debug build failure running 'make distcheck' on source trees configured with --enable-doctool. https://bugzilla.gnome.org/show_bug.cgi?id=751238
* scanner: add "XDG Base Directory" functionsDieter Verfaillie2015-06-203-48/+100
| | | | | | | | | | | | Extract cache and data dir lookup code into documented get_user_cache_dir() and get_system_data_dirs() functions. Note that previously, the data dirs code did not fall back to '/usr/local/share:/usr/share' when the XDG_DATA_DIRS environment variable was either not set or empty, as required by the XDG Base Directory Specification. https://bugzilla.gnome.org/show_bug.cgi?id=747770
* scanner: honor XDG_CACHE_HOMEDieter Verfaillie2015-06-201-0/+5
| | | | | | | | We already use XDG_DATA_DIRS for .gir files lookup so we might as well honor XDG_CACHE_HOME instead of hardcoding ~/.cache. https://bugzilla.gnome.org/show_bug.cgi?id=747770
* docmain: port to using argparse.Mathieu Duponchelle2015-06-171-17/+15
| | | | optparse is deprecated.
* scanner/girepository: remove GdkRectangle->CairoRectangleInt automatic ↵Lionel Landwerlin2015-05-111-6/+0
| | | | | | conversion https://bugzilla.gnome.org/show_bug.cgi?id=748832
* scanner: Add --symbol-filter-cmdGarrett Regier2015-04-202-2/+22
| | | | | | | | | | Add the command line flag --symbol-filter-cmd to g-ir-scanner which allows running symbol names through a filtering shell command. The symbol is sent as stdin to the filter command and expects a filtered result written to stdout. https://bugzilla.gnome.org/show_bug.cgi?id=744534 Signed-off-by: Garrett Regier <garrett.regier@riftio.com>
* scanner: remove stray debug spewDieter Verfaillie2015-04-191-1/+0
| | | | | remove stray debugging print statement introduced in db7ab0e797f755fb7ff273a2071d27fd62a2b7c7
* scanner: Don't fail when GI_SCANNER_DISABLE_CACHE is setGarrett Regier2015-04-191-2/+2
| | | | | | | | | It was assumed that cache store was always working, this also removes a round trip to the cache store. So performance should also get a small boost. https://bugzilla.gnome.org/show_bug.cgi?id=746231 Signed-off-by: Garrett Regier <garrett.regier@riftio.com>
* scanner: allow multiline annotationsDieter Verfaillie2015-04-181-50/+49
| | | | | | | Allow `identifier`, `parameter` and `tag` part `annotations` fields to span multiple lines https://bugzilla.gnome.org/show_bug.cgi?id=676133
* scanner: sync with upstream OrderedDictDieter Verfaillie2015-04-181-13/+26
| | | | Synced with https://github.com/zzzeek/sqlalchemy/commit/a4a826021fb6d77fadbdac0071616d7e5486e4d1
* scanner: fix a docstring typoDieter Verfaillie2015-04-181-1/+1
|
* build: use the detected pkg-configSaleem Abdulrasool2015-03-241-1/+1
| | | | | | | | | | Rather than assuming that pkg-config is spelt pkg-config, use the environment variable $PKG_CONFIG which is the actual detected pkg-config spelling. This is particularly important when cross-compiling, where the pkg-config may be prefixed with the target and will actually provide a different result from the build pkg-config which may be available unprefixed. https://bugzilla.gnome.org/show_bug.cgi?id=746669
* giscanner: enable the --reparse-validate option for our test suiteDieter Verfaillie2015-03-041-1/+19
| | | | | | | | | | Doing so reveals GIRParser did not yet support: - the (skip) annotation on parameters and return values - the (attributes) annotation This patch fixes both issues an prevents further similar problems. https://bugzilla.gnome.org/show_bug.cgi?id=738171
* scanner: Support the C99 'bool' typeEmmanuele Bassi2015-03-042-0/+3
| | | | | | Otherwise API using it will badly break in weird ways. https://bugzilla.gnome.org/show_bug.cgi?id=745608
* scanner: allow (array zero-terminated) instead of (array zero-terminated=1)Dieter Verfaillie2015-03-032-4/+13
| | | | | | | | | | | | | | What we already had: - (array zero-terminated=1) > array which is NULL terminated - (array zero-terminated=0) > array which is not NULL terminated - (array) > array which is not NULL terminated - (array zero-terminated=X) > array which is not NULL terminated where X can be anything What this patch adds: - (array zero-terminated) > array which is NULL terminated https://bugzilla.gnome.org/show_bug.cgi?id=657754
* girepository: Document semantics of dependencies and includes betterPhilip Withnall2015-02-161-0/+1
| | | | | | | | Make it clear that both the dependencies field in the typelib, and the include elements in the GIR AST, are for immediate dependencies, not transitive ones. https://bugzilla.gnome.org/show_bug.cgi?id=743782
* scanner: don't pass certain debug level flags to cppMichael Catanzaro2015-02-131-0/+8
| | | | | | | These may cause cpp to output code that still has #defines in them, which the scanner does not expect. https://bugzilla.gnome.org/show_bug.cgi?id=720504
* scanner: Honor nested types on array declarations as wellColin Walters2014-09-051-1/+4
| | | | | | | | | We have special code to look at (type GLib.List(utf8)), but (type GLib.PtrArray(utf8)) didn't work. This allows NetworkManager to annotate the ActiveConnections property. https://bugzilla.gnome.org/show_bug.cgi?id=733879
* giscanner: Add Optional Options for CodegenChun-wei Fan2014-09-043-6/+82
| | | | | | | | | | | | | | | | | This adds options to scannermain so that we can decorate functions with macros as needed, so that we can use compiler annotations for symbol export for example. Options are also added to include headers before or after the main include block at the top so that we can include headers as necessary in the generated sources and/or headers, so that we could for example grab definitions from those headers as needed, such as to grab definitions of macros used for symbol export. The testcodegen.py script has been updated as well to make use of this functionality, if needed. https://bugzilla.gnome.org/show_bug.cgi?id=732669
* Fix windows buildIgnacio Casal Quinteiro2014-09-021-2/+2
|
* scannerlexer.l: Update to Support MSVC PreprocessorChun-wei Fan2014-08-151-5/+18
| | | | | | | | | | | | | | This updates giscanner/scannerlexer.l by ignoring the Visual C++-specific directives, so that the scanner will not bail out while trying to produce the introspection dumper program source code, and silence many of the warnings that are produced in the process. As the Visual C++ processor produces slightly different line markers, we need to handle this here as well, otherwise the sources/headers would not be processed to acquire the _get_type and _get_gtype symbols to put in the introspection dumper sources, producing bad results. https://bugzilla.gnome.org/show_bug.cgi?id=728313
* Revert "codegen.py: Update Generation of everything.[c|h]"Chun-wei Fan2014-08-151-10/+1
| | | | This reverts commit 7a82752734b496bb619fce62572c0c7f8578350a.
* codegen.py: Update Generation of everything.[c|h]Chun-wei Fan2014-08-151-1/+10
| | | | | | | | Update everything.h include the header used to decorate symbols with the macro for export and everything.c to include config.h first, and have the symbols decorated with the aforementioned macro. https://bugzilla.gnome.org/show_bug.cgi?id=732669
* Check for MINGW instead of MINGW32Ignacio Casal Quinteiro2014-08-061-1/+2
| | | | | | New versions of msys2 provide a MINGW64 env variable instead. https://bugzilla.gnome.org/show_bug.cgi?id=734163
* giscanner: Add New CCompiler ModuleChun-wei Fan2014-08-053-157/+221
| | | | | | | | | | | | | | | This adds a CCompiler module for the giscanner Python scripts so that items related to the run of the preprocessor, compiler and linker can be done in this module, and this marks the beginning of the move of building the introspection files using Python's distutils. This patch first moves _add_[internal|external]_link_flags() to ccompiler.py as get_[internal|external]_link_flags and also moves the Windows shlibs resolution (deducing the DLLs the introspection files should link to from the libraries passed in) in shlibs.py to resolve_windows_libs() in ccompiler.py https://bugzilla.gnome.org/show_bug.cgi?id=728313
* giscanner/cachestore.py: Clean up a bitChun-wei Fan2014-08-011-4/+1
| | | | | | | Use the special os.path.expanduser('~'), as it it more portable, instead of quering the HOME or HOMEPATH envvar. https://bugzilla.gnome.org/show_bug.cgi?id=732668
* giscanner: Make _get_cachedir() Always Work on WindowsChun-wei Fan2014-07-041-1/+4
| | | | | | | | | | On Windows, checking for $(HOME) will work in a MSYS shell but not in cmd.exe (i.e. Visual Studio command prompt), so we need to check for HOMEPATH when we are building under a Visual Studio command prompt to get the users's home directory correctly. This will enable g-ir-doc-tool to work on Windows when run from cmd.exe. https://bugzilla.gnome.org/show_bug.cgi?id=732668
* scanner: Add --identifier-filter-cmdSimon Feltman2014-06-032-2/+21
| | | | | | | | | Add the command line flag --identifier-filter-cmd to g-ir-scanner which allows running identifier names through a filtering shell command. The identifier is sent as stdin to the filter command and expects a filtered result written to stdout. https://bugzilla.gnome.org/show_bug.cgi?706898
* annotationparser: more nullable fixesRyan Lortie2014-05-081-0/+2
| | | | | Add ANN_NULLABLE and ANN_OPTIONAL in the one (and only) other place that ANN_ALLOW_NONE is mentioned...
* giscanner: allow (nullable) and (optional)Ryan Lortie2014-05-071-2/+2
| | | | | | | Add (nullable) and (optional) as recognised annotations in the same places that (allow-none) is allowed. This should have been done in the previous commits but the tests were passing because the only ill effect was that a warning was issued.
* Revert "giscanner: don't accept (allow-none) on Returns:"Ryan Lortie2014-05-061-1/+1
| | | | | | | This reverts commit 0839e696e9fbc1942ac5c61054de3b47e9578152. This was accidentally picked up by my 'git bz apply' against the bug as I was getting ready to push the last set of changes.
* giscanner: fix a comparisonRyan Lortie2014-05-061-1/+1
| | | | | | | | In the case that a parameter has not been explicitly annotated, the value of node.direction will be None, not 'in'. Instead of comparing as == 'in' we should therefore check for being != 'out'. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: support nullable return types tooRyan Lortie2014-05-063-6/+9
| | | | | | | | | | Promote the 'nullable' field to the TypeContainer base class (which is shared by Return and Parameter types). Add .gir support for nullability on return values, both in the writer and in the (scanner's) parser. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: add (nullable) and (optional) annotationsRyan Lortie2014-05-062-1/+33
| | | | | | | | | | | Add two new annotations, (nullable) and (optional). (nullable) always means "the type of this value can also contain null". (optional) always means "this out parameter can be ignored by passing NULL to the C function". https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: write nullable and optional attributesRyan Lortie2014-05-063-3/+8
| | | | | | | | | | | | | | | | | | | Record our internal 'nullable' and 'optional' attributes into the written .gir file. It is now theoretically possible to express the concept of an out parameter with a nullable type (although presently there is no way to do this). Modify our own internal parser (in the scanner) to understand the newly-written attributes. Update the expected output of the 'Regress-1.0.gir' test to account for the new attributes. Nothing else understands 'nullable' yet, but the girparser in the typelib compiler already understands 'optional' and records a bit for it in the typelib. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: change some internal field logicRyan Lortie2014-05-063-5/+20
| | | | | | | | | | | | | | | | | | Replace the 'allow_none' field on parameters with two separate fields: 'nullable' and 'optional'. Currently, we use 'nullable' to mean the same thing as 'allow-none' for normal (non-out) parameters. For out parameters, we use the 'optional' field instead. Note that the special case for GCancellable and GAsyncReadyCallback is already guarded by a check for being an in parameter, so we always use 'nullable' here. On the .gir writer side, we decide which variable to consult when writing the allow-none attribute depending on the parameter direction. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: tweak GCancellable null special caseRyan Lortie2014-05-061-2/+3
| | | | | | | | | | | | | | We treat GCancellable and GAsyncReadyCallback as if they were always tagged (allow-none) because these parameters universally allow %NULL to be given as a value when they appear as in parameters on functions. Unfortunately, the meaning of (allow-none) is different on out parameters. There it means that you can give %NULL to ignore the return value. Limit this special case to only in parameters. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* maintransformer: split up a complex conditionalRyan Lortie2014-05-061-3/+5
| | | | | | | | | | | | We assign node.allow_none in two separate cases: - if the (allow-none) annotation was given - for GCancellable and GAsyncReadyCallback, as special cases Split the two up. This will simplify future commits. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: don't accept (allow-none) on Returns:Dieter Verfaillie2014-05-061-1/+1
| | | | | | | | | The old annotationparser.py happily parsed this, but giscanner/girwriter.py never serialized an allow-none attribute to the .gir file and girepository/girparser.c never looked for an allow-none attribute either. https://bugzilla.gnome.org/show_bug.cgi?id=660879
* giscanner: Use range instead of xrange for Python 3 compatibilitySimon Feltman2014-05-011-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=679438
* giscanner: Use modern exception handling for Python 3 compatibilitySimon Feltman2014-05-011-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=679438