| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| | |
Drop all Python 2 compat code
See merge request GNOME/gobject-introspection!85
|
| |
| |
| |
| | |
We only support 3.4+ now.
|
|/
|
|
|
| |
pickle.loads() can pretty much throw any kind of exception and we can't
handle it besides ignoring it, so just catch all.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Different Python versions are not completely consistent about the
error that is raised and its class hierarchy:
Python 3.5.3rc1 (default, Jan 3 2017, 04:40:57)
>>> try: open('/foo')
... except Exception as e: print(e.__class__.__mro__)
(<class 'FileNotFoundError'>, <class 'OSError'>, <class 'Exception'>, <class 'BaseException'>, <class 'object'>)
Python 2.7.13 (default, Dec 18 2016, 20:19:42)
>>> try: open('/foo')
... except Exception as e: print e.__class__.__mro
(<type 'exceptions.IOError'>, <type 'exceptions.EnvironmentError'>, <type 'exceptions.StandardError'>, <type 'exceptions.Exception'>, <type 'exceptions.BaseException'>, <type 'object'>)
This can lead to a race condition during cache cleaning, where two
processes both try to delete the same file, and the one that loses
the race fails.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Iain Lane <laney@ubuntu.com>
Reviewed-by: Colin Walters <walters@verbum.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=772173
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
|
|
| |
This adds compatibility with Python 3 which removed the
cPickle module.
Explicitly use binary files for reading and writing the cache.
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add unicode_literals future import which turns any string literal
into a unicode string. Return unicode strings from the Python C extension
module. Force writing of annotations (g-ir-annotation-tool) to output utf8
encoded data to stdout.
This is an initial pass at following the "unicode sandwich"
model of programming (http://nedbatchelder.com/text/unipain.html)
needed for supporting Python 3.
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
|
| |
Use future import "print_function" and update relevant uses of print
as a function call. See: PEP 3105
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
|
|
|
|
| |
Import Python 3 compatible "true division" from the future (PEP 238).
This changes the Python 2 classic division which uses floor division
on integers to true division. Verfied we don't actually use the
division operator anywhere in the code base so this a safety for
supporting both Python 2 and 3.
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
| |
Use absolute_import to ensure Python 3 compatibility of the code base.
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
| |
Ensures files are correctly and immediately closed.
https://bugzilla.gnome.org/show_bug.cgi?id=751926
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=679438
|
|
|
|
|
|
|
| |
This should fix race conditions when multiple processes attempt to
access the cache concurrently.
https://bugzilla.gnome.org/show_bug.cgi?id=724886
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Version in our tree is a wee bit outdated. For example,
later work will introduce an utf8 encoded python source
file which our old pep8.py does not yet understand (yeah,
it really was *that* ancient)...
Updated from:
https://raw.github.com/jcrocholl/pep8/1.4.5/pep8.py
Takes 552c1f1525e37a30376790151c1ba437776682c5,
f941537d1c0a40f0906490ed160db6c79af572d3,
5a4afe2a77d0ff7d9fea13dd93c3304a6ca993de and
a17f157e19bd6792c00321c8020dca5e5a281f45 into account...
https://bugzilla.gnome.org/show_bug.cgi?id=699535
|
|
|
|
|
|
| |
It's more readable and as an added bonus Python 3 compatible.
https://bugzilla.gnome.org/show_bug.cgi?id=697616
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=649054
|
|
|
|
|
| |
Hit this race in practice with two g-ir-scanner invocations
in Fedora's koji.
|
| |
|
|
|
|
|
| |
Propertly clear the cache after a version invalidation.
Send in the full filename to unlink, not just the basename.
|
|
|
|
|
|
|
|
| |
Version the cache by checking the SHA1 of the content of all
python source files. If the SHA1 hash differs, just regenerate the
cache.
https://bugzilla.gnome.org/show_bug.cgi?id=568842
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=596960
|
|
|
|
| |
This is really why you shouldn't catch TypeError.
|
|
|
|
|
|
|
|
|
|
| |
2009-01-13 Johan Dahlin <jdahlin@async.com.br>
* giscanner/cachestore.py (CacheStore.load): Catch AttributeError
which seems to be occasionally raised for Record.
svn path=/trunk/; revision=1031
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-12-09 Johan Dahlin <johan@async.com.br>
* giscanner/cachestore.py (CacheStore.store): Use
shutil.move instead of os.rename, since it will
automatically fall back to copying+remove if the
src directory is on a different partition from
the dst directory.
svn path=/trunk/; revision=989
|
|
|
|
|
|
|
|
|
|
|
| |
2008-12-08 Johan Dahlin <johan@async.com.br>
* giscanner/cachestore.py (_get_cachedir): Don't require
HOME to be set and if it set, don't require the
directory to exist.
svn path=/trunk/; revision=987
|
|
|
|
| |
svn path=/trunk/; revision=986
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-12-08 Johan Dahlin <johan@async.com.br>
* giscanner/cachestore.py (CacheStore.store): Dump the cache
file to a temporary file and rename it the expected filename
only when it's completely written.
This should make the cache more roboust when run in parallel,
and hopefully avoid triggering bugs in Python.
svn path=/trunk/; revision=985
|
|
|
|
| |
svn path=/trunk/; revision=980
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-11-30 Johan Dahlin <jdahlin@async.com.br>
Bug 562289 – Race when removing invalid cache
* giscanner/cachestore.py:
ENOENT is mapped to a OSError, not IOError.
svn path=/trunk/; revision=979
|
|
|
|
|
|
|
|
|
|
| |
2008-11-19 Johan Dahlin <jdahlin@async.com.br>
* giscanner/cachestore.py:
Catch ValueError exceptions.
svn path=/trunk/; revision=950
|
|
|
|
|
|
|
|
|
|
| |
2008-11-18 Johan Dahlin <jdahlin@async.com.br>
* giscanner/cachestore.py:
Catch BadPickleGet exceptions as well.
svn path=/trunk/; revision=942
|
|
|
|
|
|
|
|
|
|
|
| |
2008-11-07 Johan Dahlin <jdahlin@async.com.br>
* giscanner/cachestore.py:
Handle broken cache entries, write only filesystems and
running out of diskspace.
svn path=/trunk/; revision=867
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-11-04 Johan Dahlin <jdahlin@async.com.br>
* giscanner/__init__.py:
* giscanner/ast.py:
* giscanner/cachestore.py:
* giscanner/cgobject.py:
* giscanner/girparser.py:
* giscanner/girwriter.py:
* giscanner/giscannermodule.c:
* giscanner/glibast.py:
* giscanner/glibtransformer.py:
* giscanner/libtoolimporter.py:
* giscanner/minixpath.py:
* giscanner/odict.py:
* giscanner/sourcescanner.c:
* giscanner/sourcescanner.h:
* giscanner/sourcescanner.py:
* giscanner/transformer.py:
* giscanner/utils.py:
* giscanner/xmlwriter.py:
* COPYING:
Relicense the giscanner library under LGPLv2+.
This has been approved by all contributors.
svn path=/trunk/; revision=862
|
|
2008-10-30 Johan Dahlin <jdahlin@async.com.br>
* giscanner/girparser.py:
Remove arguments from the constructor, move them to
separate accessors. Add a new parse_tree method
which takes an element tree instance.
* tools/g-ir-scanner:
Update callsite for this
* giscanner/Makefile.am:
* giscanner/cachestore.py:
* giscanner/transformer.py:
Cache the include parsing. Saves ~25% time when
creating vte (which includes everything up to gtk+).
svn path=/trunk/; revision=842
|