aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/ninjabackend.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2021-06-29 20:52:55 +0300
committerGitHub <noreply@github.com>2021-06-29 20:52:55 +0300
commit4bfee181c5a166e3d429bd265e06d299dce50f30 (patch)
tree8918a0e09f668ed55748ec254c51b4d92b5403a9 /mesonbuild/backend/ninjabackend.py
parent81ca0ec7ae975723b8b399b9f142286895a45dab (diff)
parentc0a2025d038a08092212bfc45e7bbb46ff1e8e52 (diff)
downloadmeson-4bfee181c5a166e3d429bd265e06d299dce50f30.zip
meson-4bfee181c5a166e3d429bd265e06d299dce50f30.tar.gz
meson-4bfee181c5a166e3d429bd265e06d299dce50f30.tar.bz2
Merge pull request #8918 from mensinda/pathlibFixes
pathlib: Patch pathlib to work around some bugs (fixes #8263 #7295)
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
-rw-r--r--mesonbuild/backend/ninjabackend.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 192cef3..597789b 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -20,6 +20,7 @@ import subprocess
from collections import OrderedDict
from enum import Enum, unique
import itertools
+from textwrap import dedent
from pathlib import PurePath, Path
from functools import lru_cache
@@ -462,10 +463,11 @@ class NinjaBackend(backends.Backend):
return open(tempfilename, 'a', encoding='utf-8')
filename = os.path.join(self.environment.get_scratch_dir(),
'incdetect.c')
- with open(filename, 'w') as f:
- f.write('''#include<stdio.h>
-int dummy;
-''')
+ with open(filename, 'w', encoding='utf-8') as f:
+ f.write(dedent('''\
+ #include<stdio.h>
+ int dummy;
+ '''))
# The output of cl dependency information is language
# and locale dependent. Any attempt at converting it to
@@ -1215,7 +1217,7 @@ int dummy;
manifest_path = os.path.join(self.get_target_private_dir(target), 'META-INF', 'MANIFEST.MF')
manifest_fullpath = os.path.join(self.environment.get_build_dir(), manifest_path)
os.makedirs(os.path.dirname(manifest_fullpath), exist_ok=True)
- with open(manifest_fullpath, 'w') as manifest:
+ with open(manifest_fullpath, 'w', encoding='utf-8') as manifest:
if any(target.link_targets):
manifest.write('Class-Path: ')
cp_paths = [os.path.join(self.get_target_dir(l), l.get_filename()) for l in target.link_targets]