diff --git a/bypy/devenv.go b/bypy/devenv.go index 773881273..a5fea2272 100755 --- a/bypy/devenv.go +++ b/bypy/devenv.go @@ -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, " ")) diff --git a/setup.py b/setup.py index efb85e52e..27677c97b 100755 --- a/setup.py +++ b/setup.py @@ -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)