Move include path logic for develop into setup.py

This commit is contained in:
Kovid Goyal
2023-07-28 10:23:54 +05:30
parent 9dd623658a
commit aab1bf305a
2 changed files with 5 additions and 3 deletions

View File

@@ -187,7 +187,6 @@ func build(args []string) {
}
python := ""
root, _ := filepath.Abs(filepath.Join(folder, "root"))
path_args := []string{"-I" + filepath.Join(root, "include"), "-L" + filepath.Join(root, "lib")}
os.Setenv("DEVELOP_ROOT", root)
prepend("PKG_CONFIG_PATH", filepath.Join(root, "lib", "pkgconfig"))
switch runtime.GOOS {
@@ -198,8 +197,7 @@ func build(args []string) {
default:
exit("Building is only supported on Linux and macOS")
}
args = append([]string{"setup.py", "develop", "--debug"}, path_args...)
cmd := exec.Command(python, args...)
cmd := exec.Command(python, "setup.py", "develop", "--debug")
cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr
if err := cmd.Run(); err != nil {
fmt.Fprintln(os.Stderr, "The following build command failed:", python, strings.Join(args, " "))

View File

@@ -438,6 +438,10 @@ def init_env(
set_arches(cflags)
set_arches(ldflags)
if os.environ.get("DEVELOP_ROOT"):
cflags.insert(0, f'-I{os.environ["DEVELOP_ROOT"]}/include')
ldpaths.insert(0, f'-L{os.environ["DEVELOP_ROOT"]}/lib')
return Env(cc, cppflags, cflags, ldflags, library_paths, ccver=ccver, ldpaths=ldpaths, vcs_rev=vcs_rev)