+import os
+
+srcdir = os.path.split(__file__)[0]
+
+sr_includes, sr_lib_dirs, sr_libs, (sr_version,) = [
+ subprocess.check_output(
+ ["pkg-config", option, "glib-2.0", "glibmm-2.4", "pygobject-3.0"]
+ ).decode().rstrip().split(' ')
+ for option in
+ ("--cflags-only-I", "--libs-only-L", "--libs-only-l", "--modversion")]
+
+includes = ['../../include', '../cxx/include']
+includes += [os.path.join(srcdir, path) for path in includes]
+includes += ['../..', '../../include/libsigrok', '../cxx/include/libsigrok']
+includes += [i[2:] for i in sr_includes]
+libdirs = ['../../.libs', '../cxx/.libs'] + [l[2:] for l in sr_lib_dirs]
+libs = [l[2:] for l in sr_libs] + ['sigrokxx']
+
+def vpath(file):
+ vfile = os.path.join(srcdir, file)
+ return vfile if os.path.exists(vfile) else file