Skip to content

Commit 3a27394

Browse files
committed
Handle None cases for encoded paths to configure emission
1 parent d9cf62b commit 3a27394

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

lib/config.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,27 @@ class Configuration:
4848
def __init__(self):
4949
pass
5050

51+
def _encode_path(self, path):
52+
if path is not None:
53+
return path.absolute()
54+
else:
55+
return None
56+
5157
def write(self, path):
5258
info = {
5359
'version' : self.version,
5460
'command' : self.command,
5561
'project' : self.project,
56-
'script_path' : self.script_path.absolute(),
57-
'build_script_path' : self.build_script_path.absolute(),
58-
'source_root' : self.source_root.absolute(),
62+
'script_path' : self._encode_path(self.script_path),
63+
'build_script_path' : self._encode_path(self.build_script_path),
64+
'source_root' : self._encode_path(self.source_root),
5965
'target' : self.target.triple,
60-
'system_root' : self.system_root.absolute(),
66+
'system_root' : self._encode_path(self.system_root),
6167
'toolchain' : self.toolchain,
62-
'build_directory' : self.build_directory.absolute(),
63-
'intermediate_directory' : self.intermediate_directory.absolute(),
64-
'module_cache_directory' : self.module_cache_directory.absolute(),
65-
'install_directory' : self.install_directory.absolute(),
68+
'build_directory' : self._encode_path(self.build_directory),
69+
'intermediate_directory' : self._encode_path(self.intermediate_directory),
70+
'module_cache_directory' : self._encode_path(self.module_cache_directory),
71+
'install_directory' : self._encode_path(self.install_directory),
6672
'prefix' : self.prefix,
6773
'swift_install' : self.swift_install,
6874
'clang' : self.clang,
@@ -71,7 +77,7 @@ def write(self, path):
7177
'swiftc' : self.swiftc,
7278
'ar' : self.ar,
7379
'swift_sdk' : self.swift_sdk,
74-
'bootstrap_directory' : self.bootstrap_directory.absolute(),
80+
'bootstrap_directory' : self._encode_path(self.bootstrap_directory),
7581
'verbose' : self.verbose,
7682
'extra_c_flags' : self.extra_c_flags,
7783
'extra_swift_flags' : self.extra_swift_flags,

0 commit comments

Comments
 (0)