Skip to content

Commit

Permalink
project_file.mako: handle non-ASCII directory names
Browse files Browse the repository at this point in the history
For GitHub issue #643
  • Loading branch information
pmderodat committed May 23, 2022
1 parent 3881d1a commit 9e5e924
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions langkit/templates/project_file.mako
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,14 @@ library project ${lib_name} is
## no simple setup is possible, and this reduces the number of places that
## have to worry about these things to this Mako template and to the
## langkit.coverage module.
Primary_Source_Dirs :=
(${', '.join(ascii_repr(emitter.path_to(d, project_path))
for d in source_dirs if d)});
Primary_Source_Dirs := (${', '.join(
## GPR tools expect UTF-8 project files (i.e. the default encoding for
## rendered template in Langkit), and we cannot use bytes_repr to format
## the corresponding string literals, as bytes_repr assumes Ada
## (``Character'Val (1)`` is invalid in the GPR world).
'"{}"'.format(emitter.path_to(d, project_path).replace('"', '""'))
for d in source_dirs if d
)});

% if emitter.coverage:
Secondary_Source_Dirs :=
Expand Down

0 comments on commit 9e5e924

Please sign in to comment.