diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-04 17:28:44 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-04 17:28:44 +0000 |
commit | 878dc3c09478f375dd7b495eff8cbce086779e35 (patch) | |
tree | 193416cdcd9ccc50d7eef7de5cf217e9c0af4e25 /tools/generate_library_loader | |
parent | dffd2b767d0cefdb4e5176915d506c555eff0328 (diff) | |
download | chromium_src-878dc3c09478f375dd7b495eff8cbce086779e35.zip chromium_src-878dc3c09478f375dd7b495eff8cbce086779e35.tar.gz chromium_src-878dc3c09478f375dd7b495eff8cbce086779e35.tar.bz2 |
Linux library loaders: use relative path for includes (for distcc).
BUG=163209, 162733
Review URL: https://codereview.chromium.org/11414271
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170990 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/generate_library_loader')
-rwxr-xr-x | tools/generate_library_loader/generate_library_loader.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/generate_library_loader/generate_library_loader.py b/tools/generate_library_loader/generate_library_loader.py index 07e8a09..0f5e051 100755 --- a/tools/generate_library_loader/generate_library_loader.py +++ b/tools/generate_library_loader/generate_library_loader.py @@ -163,10 +163,12 @@ def main(): if not args: parser.error('No function names specified') - # Make sure we are always dealing with an absolute path + # Make sure we are always dealing with paths relative to source tree root # to avoid issues caused by different relative path roots. - options.output_cc = os.path.abspath(options.output_cc) - options.output_h = os.path.abspath(options.output_h) + source_tree_root = os.path.abspath( + os.path.join(os.path.dirname(__file__), '..', '..')) + options.output_cc = os.path.relpath(options.output_cc, source_tree_root) + options.output_h = os.path.relpath(options.output_h, source_tree_root) # Create a unique prefix, e.g. for header guards. # Stick a known string at the beginning to ensure this doesn't begin @@ -215,7 +217,7 @@ def main(): # Make it easier for people to find the code generator just in case. # Doing it this way is more maintainable, because it's going to work # even if file gets moved without updating the contents. - generator_path = os.path.abspath(__file__) + generator_path = os.path.relpath(__file__, source_tree_root) header_contents = HEADER_TEMPLATE % { 'generator_path': generator_path, @@ -234,13 +236,13 @@ def main(): 'member_cleanup': ''.join(member_cleanup), } - header_file = open(options.output_h, 'w') + header_file = open(os.path.join(source_tree_root, options.output_h), 'w') try: header_file.write(header_contents) finally: header_file.close() - impl_file = open(options.output_cc, 'w') + impl_file = open(os.path.join(source_tree_root, options.output_cc), 'w') try: impl_file.write(impl_contents) finally: |