Skip to content

Commit

Permalink
gh-118876: Ensure PC/layout sets ns.temp before using it (GH-118880)
Browse files Browse the repository at this point in the history
Fixes an AttributeError that occurs when checking if ns.temp is an absolute path during building from source on Windows.
(cherry picked from commit d8a82cc)

Co-authored-by: I-Shen Leong <i-shenl@activestate.com>
  • Loading branch information
miss-islington and i-shenl authored May 13, 2024
1 parent ce3fdf7 commit 2430729
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions PC/layout/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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():
Expand Down

0 comments on commit 2430729

Please sign in to comment.