Skip to content

Commit a972a51

Browse files
🎐 Fix macOS host to Windows target
1 parent 0a5cc66 commit a972a51

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

setup.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@
4040
}[platform.machine()]
4141

4242
# Name of the Hugo binary that will be built
43-
HUGO_BINARY_NAME = (
44-
f"hugo-{HUGO_VERSION}-{HUGO_PLATFORM}-{os.environ.get('GOARCH', HUGO_ARCH)}"
45-
+ FILE_EXT
46-
)
43+
# Can be overridden during cross-compilation
44+
HUGO_BINARY_NAME = f"hugo-{HUGO_VERSION}-{os.environ.get('GOOS', HUGO_ARCH)}-{os.environ.get('GOARCH', HUGO_ARCH)}{FILE_EXT}"
4745

4846
# ----------------------------------------------------------------------------------
4947

@@ -370,7 +368,7 @@ def get_tag(self):
370368

371369
# Handle cross-compilation on/to Windows via the Zig compiler
372370
# ===========================================================
373-
if os.environ.get("GOOS") == "windows" or (sys.platform == "win32"):
371+
elif os.environ.get("GOOS") == "windows" or (sys.platform == "win32"):
374372
if os.environ.get("GOARCH") == "arm64":
375373
platform_tag = "win_arm64"
376374
elif os.environ.get("GOARCH") == "amd64":
@@ -386,7 +384,7 @@ def get_tag(self):
386384
# Also, let cibuildwheel handle the platform tags if it is being used,
387385
# since that is where we won't cross-compile at all but use the native
388386
# GitHub Actions runners.
389-
if ((os.environ.get("GOOS") == "darwin") or (sys.platform == "darwin")) and (
387+
elif ((os.environ.get("GOOS") == "darwin") or (sys.platform == "darwin")) and (
390388
os.environ.get("CIBUILDWHEEL") != "1"
391389
):
392390
if os.environ.get("GOARCH") == "arm64":
@@ -439,6 +437,5 @@ def run(self):
439437
f"binaries/{HUGO_BINARY_NAME}",
440438
],
441439
},
442-
# has to be kept in sync with the version in hugo/cli.py
443440
version=HUGO_VERSION,
444441
)

0 commit comments

Comments
 (0)