Skip to content

Commit ff38e8c

Browse files
committed
Fix Windows build: use correct executable path for m68kmake
On Windows, link_executable() produces m68kmake.exe but the build script referenced the extensionless "build/m68kmake" for existence checks, subprocess invocation, and cleanup. Additionally, subprocess on Windows requires OS-native path separators for relative paths. Introduce gen_tool_exe using os.path.join() to produce a path with both the correct extension (.exe on Windows) and native separators.
1 parent 61600df commit ff38e8c

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

setup.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
gen_src = ["m68kopac.c", "m68kopdm.c", "m68kopnz.c", "m68kops.c"]
5151

5252
gen_tool = "build/m68kmake"
53+
gen_tool_exe = os.path.join("build", "m68kmake.exe" if sys.platform == "win32" else "m68kmake")
5354
gen_tool_src = "src/musashi/m68kmake.c"
5455
gen_tool_obj = "build/src/musashi/m68kmake.o"
5556
gen_input = "src/musashi/m68k_in.c"
@@ -98,9 +99,9 @@ def run(self):
9899
log.info("creating '{}' dir".format(build_dir))
99100
os.mkdir(build_dir)
100101
# build tool first?
101-
if not os.path.exists(gen_tool):
102+
if not os.path.exists(gen_tool_exe):
102103
cc = ccompiler.new_compiler()
103-
log.info("building '{}' tool".format(gen_tool))
104+
log.info("building '{}' tool".format(gen_tool_exe))
104105
# win fixes
105106
src = gen_tool_src.replace("/", os.path.sep)
106107
print("tool source:", src)
@@ -126,7 +127,7 @@ def run(self):
126127
# generate source?
127128
if not os.path.exists(gen_src[0]):
128129
log.info("generating source files")
129-
cmd = [gen_tool, gen_dir, gen_input]
130+
cmd = [gen_tool_exe, gen_dir, gen_input]
130131
subprocess.check_call(cmd)
131132

132133

@@ -146,8 +147,8 @@ def run(self):
146147
if os.path.exists(gen_dir):
147148
remove_tree(gen_dir, dry_run=self.dry_run)
148149
# remove tool
149-
if os.path.exists(gen_tool):
150-
os.remove(gen_tool)
150+
if os.path.exists(gen_tool_exe):
151+
os.remove(gen_tool_exe)
151152

152153

153154
# my custom commands

0 commit comments

Comments
 (0)