diff options
author | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-10-17 17:43:48 +0200 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2013-10-17 15:04:50 -0400 |
commit | ebb80508d6959a0c94351e841c2cab6220602e62 (patch) | |
tree | da08996f1ce0f1904a6bd64eabb7d6665b0364bc /giscanner/sourcescanner.py | |
parent | 65a0fa4c4e005047af7ec029c733bed4bd80292f (diff) | |
download | gobject-introspection-ebb80508d6959a0c94351e841c2cab6220602e62.tar.gz |
giscanner: remove g_realpath
giscannermodule expects file names to be canonicalized and
symlinks to be resolved (most likely to support users of
symlinked /usr/local). Instead of computing absolute and real
paths all over the place, we can do this once on entry
in SourceScanner().parse_files() and SourceScanner().parse_macros()
and clean the rest a bit...
https://bugzilla.gnome.org/show_bug.cgi?id=710320
Diffstat (limited to 'giscanner/sourcescanner.py')
-rw-r--r-- | giscanner/sourcescanner.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py index d5c43926..3444445e 100644 --- a/giscanner/sourcescanner.py +++ b/giscanner/sourcescanner.py @@ -237,14 +237,14 @@ class SourceScanner(object): def parse_files(self, filenames): for filename in filenames: - filename = os.path.abspath(filename) + # self._scanner expects file names to be canonicalized and symlinks to be resolved + filename = os.path.realpath(filename) self._scanner.append_filename(filename) self._filenames.append(filename) headers = [] for filename in filenames: if os.path.splitext(filename)[1] in SOURCE_EXTS: - filename = os.path.abspath(filename) self._scanner.lex_filename(filename) else: headers.append(filename) @@ -253,7 +253,8 @@ class SourceScanner(object): def parse_macros(self, filenames): self._scanner.set_macro_scan(True) - self._scanner.parse_macros(filenames) + # self._scanner expects file names to be canonicalized and symlinks to be resolved + self._scanner.parse_macros([os.path.realpath(f) for f in filenames]) self._scanner.set_macro_scan(False) def get_symbols(self): @@ -298,7 +299,6 @@ class SourceScanner(object): for undef in undefs: proc.stdin.write('#undef %s\n' % (undef, )) for filename in filenames: - filename = os.path.abspath(filename) proc.stdin.write('#include <%s>\n' % (filename, )) proc.stdin.close() |