24 lines
885 B
Diff
24 lines
885 B
Diff
--- a/python3/setup.py
|
|
+++ b/python3/setup.py
|
|
@@ -8,6 +8,7 @@ import json
|
|
|
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
from setup_support import SetupApp, Config
|
|
+from pathlib import Path
|
|
|
|
PYTHON_DATA_SCRIPT = """
|
|
import json
|
|
@@ -47,10 +48,10 @@ def fetch_python_config(config):
|
|
|
|
def relocate(path):
|
|
if os.path.isabs(path):
|
|
- rel_path = os.path.relpath(path, build_prefix)
|
|
- if not rel_path.startswith(os.pardir):
|
|
+ if Path(path).is_relative_to(build_prefix):
|
|
# If the input path is relative to the original build
|
|
# directory, replace build prefix by the current one.
|
|
+ rel_path = Path(path).relative_to(build_prefix)
|
|
return os.path.join(current_prefix, rel_path)
|
|
else:
|
|
# Otherwise, return it unchanged
|