Add some heuristics to find out the Windows build directory

Adding the build directory to the module search path eases development
by now.
This commit is contained in:
Joerg Wunsch
2024-03-08 08:39:07 +01:00
parent 3f944559b6
commit e10730ef40

View File

@@ -14,10 +14,22 @@ import sys
import os
import pathlib
sysname = os.uname()[0].lower()
builddir = f'build_{sysname}/src'
builddir = None
if os.name == 'posix':
# Linux, *BSD, MacOS
sysname = os.uname()[0].lower()
builddir = f'build_{sysname}/src'
elif os.name == 'nt':
# Windows
for candidate in ['build_msvc/src', 'build_msys64/src']:
if os.path.exists(candidate):
builddir = candidate
break
sys.path.append(builddir)
if builddir == None:
print("Cannot determine build directory, module loading might fail.", file=sys.stderr)
else:
sys.path.append(builddir)
import swig_avrdude as ad