|
@@ -34,7 +34,25 @@ def _gn_lines(output_dir, path):
|
|
import_path = os.path.normpath(
|
|
import_path = os.path.normpath(
|
|
os.path.join(_find_root(output_dir),
|
|
os.path.join(_find_root(output_dir),
|
|
raw_import_path[2:]))
|
|
raw_import_path[2:]))
|
|
|
|
+ elif raw_import_path.startswith('/'):
|
|
|
|
+ # GN uses "/"-prefix as absolute path,
|
|
|
|
+ # https://gn.googlesource.com/gn/+/main/docs/reference.md#labels
|
|
|
|
+ # e.g.
|
|
|
|
+ # /usr/local/foo:bar
|
|
|
|
+ # /C:/Program Files/MyLibs:bar
|
|
|
|
+ # but Win32's absolute path doesn't have "/"-prefix.
|
|
|
|
+ if sys.platform.startswith('win32'):
|
|
|
|
+ import_path = raw_import_path[1:]
|
|
|
|
+ else:
|
|
|
|
+ import_path = raw_import_path
|
|
|
|
+ if not os.path.isabs(import_path):
|
|
|
|
+ raise Exception('Wrong absolute path for import %s' %
|
|
|
|
+ raw_import_path)
|
|
else:
|
|
else:
|
|
|
|
+ if os.path.isabs(raw_import_path):
|
|
|
|
+ raise Execption(
|
|
|
|
+ 'Absolute path "%s" should start with "/" in GN' %
|
|
|
|
+ raw_import_path)
|
|
import_path = os.path.normpath(
|
|
import_path = os.path.normpath(
|
|
os.path.join(os.path.dirname(path), raw_import_path))
|
|
os.path.join(os.path.dirname(path), raw_import_path))
|
|
yield from _gn_lines(output_dir, import_path)
|
|
yield from _gn_lines(output_dir, import_path)
|