Skip to content

Commit 32186a1

Browse files
committed
install: escape curly brackets in sys.prefix and sys.exec_prefix
Resolves #281
1 parent 6d3b442 commit 32186a1

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

distutils/command/install.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@
1919
from ..errors import DistutilsOptionError, DistutilsPlatformError
2020
from ..file_util import write_file
2121
from ..sysconfig import get_config_vars
22-
from ..util import change_root, convert_path, get_platform, subst_vars
22+
from ..util import (
23+
change_root,
24+
convert_path,
25+
escape_curly_brackets,
26+
get_platform,
27+
subst_vars,
28+
)
2329
from . import _framework_compat as fw
2430

2531
HAS_USER_SITE = True
@@ -562,8 +568,14 @@ def finalize_unix(self) -> None:
562568
# Allow Fedora to add components to the prefix
563569
_prefix_addition = getattr(sysconfig, '_prefix_addition', "")
564570

565-
self.prefix = os.path.normpath(sys.prefix) + _prefix_addition
566-
self.exec_prefix = os.path.normpath(sys.exec_prefix) + _prefix_addition
571+
self.prefix = (
572+
escape_curly_brackets(os.path.normpath(sys.prefix))
573+
+ _prefix_addition
574+
)
575+
self.exec_prefix = (
576+
escape_curly_brackets(os.path.normpath(sys.exec_prefix))
577+
+ _prefix_addition
578+
)
567579

568580
else:
569581
if self.exec_prefix is None:
@@ -585,7 +597,7 @@ def finalize_other(self) -> None:
585597
self.select_scheme("posix_home")
586598
else:
587599
if self.prefix is None:
588-
self.prefix = os.path.normpath(sys.prefix)
600+
self.prefix = escape_curly_brackets(os.path.normpath(sys.prefix))
589601

590602
self.install_base = self.install_platbase = self.prefix
591603
try:

0 commit comments

Comments
 (0)