summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-05-13 11:48:39 (GMT)
committerGitHub <noreply@github.com>2024-05-13 11:48:39 (GMT)
commit2430729afea18073ca11f18f641c07ae8ad2504d (patch)
treee8e911031ac5ba4d0246fcd782d6ad63c43efad2
parentce3fdf70f468cdc9a6dc744b81d2eaa91fdc32a1 (diff)
downloadcpython-2430729afea18073ca11f18f641c07ae8ad2504d.zip
cpython-2430729afea18073ca11f18f641c07ae8ad2504d.tar.gz
cpython-2430729afea18073ca11f18f641c07ae8ad2504d.tar.bz2
gh-118876: Ensure PC/layout sets ns.temp before using it (GH-118880)
Fixes an AttributeError that occurs when checking if ns.temp is an absolute path during building from source on Windows. (cherry picked from commit d8a82cca12e12a6b22bfe6691e9b222f6d276f0a) Co-authored-by: I-Shen Leong <i-shenl@activestate.com>
-rw-r--r--PC/layout/main.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/PC/layout/main.py b/PC/layout/main.py
index c924600..e836caf 100644
--- a/PC/layout/main.py
+++ b/PC/layout/main.py
@@ -575,6 +575,15 @@ def main():
ns.build = ns.build or Path(sys.executable).parent
ns.temp = ns.temp or Path(tempfile.mkdtemp())
ns.doc_build = ns.doc_build or (ns.source / "Doc" / "build")
+ if ns.copy and not ns.copy.is_absolute():
+ ns.copy = (Path.cwd() / ns.copy).resolve()
+ if not ns.temp:
+ # Put temp on a Dev Drive for speed if we're copying to one.
+ # If not, the regular temp dir will have to do.
+ if ns.copy and getattr(os.path, "isdevdrive", lambda d: False)(ns.copy):
+ ns.temp = ns.copy.with_name(ns.copy.name + "_temp")
+ else:
+ ns.temp = Path(tempfile.mkdtemp())
if not ns.source.is_absolute():
ns.source = (Path.cwd() / ns.source).resolve()
if not ns.build.is_absolute():
@@ -588,8 +597,6 @@ def main():
if not ns.arch:
ns.arch = "amd64" if sys.maxsize > 2 ** 32 else "win32"
- if ns.copy and not ns.copy.is_absolute():
- ns.copy = (Path.cwd() / ns.copy).resolve()
if ns.zip and not ns.zip.is_absolute():
ns.zip = (Path.cwd() / ns.zip).resolve()
if ns.catalog and not ns.catalog.is_absolute():