-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'consolidate_linker_args' wrapper to protect the old behavior for…
… now. Closes #246.
- Loading branch information
Showing
4 changed files
with
50 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from __future__ import annotations | ||
|
||
from .py38 import removeprefix | ||
|
||
|
||
def consolidate_linker_args(args: list[str]) -> str: | ||
""" | ||
Ensure the return value is a string for backward compatibility. | ||
Retain until at least 2024-10-31. | ||
""" | ||
|
||
if not all(arg.startswith('-Wl,') for arg in args): | ||
return args | ||
return '-Wl,' + ','.join(removeprefix(arg, '-Wl,') for arg in args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import sys | ||
|
||
if sys.version_info < (3, 9): | ||
|
||
def removesuffix(self, suffix): | ||
# suffix='' should not call self[:-0]. | ||
if suffix and self.endswith(suffix): | ||
return self[: -len(suffix)] | ||
else: | ||
return self[:] | ||
|
||
def removeprefix(self, prefix): | ||
if self.startswith(prefix): | ||
return self[len(prefix) :] | ||
else: | ||
return self[:] | ||
else: | ||
|
||
def removesuffix(self, suffix): | ||
return self.removesuffix(suffix) | ||
|
||
def removeprefix(self, prefix): | ||
return self.removeprefix(prefix) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters