X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=bindings%2Fpython%2Fsetup.py;h=c1146f1fb257dfce373bbfc0783785c50564ecf6;hb=6be7a7f287a5567361f1dadf41a9d11b828a9101;hp=0d854afd36deafb170b78f493c4aa31e2b21ac85;hpb=758b01adcbbc2cd4c077281ad06c7bb2ac414391;p=libsigrok.git diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 0d854afd..c1146f1f 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -1,45 +1,52 @@ -# -# This file is part of the sigrok project. -# -# Copyright (C) 2013 Martin Ling -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +## +## This file is part of the libsigrok project. +## +## Copyright (C) 2013 Martin Ling +## +## This program is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program. If not, see . +## -from distutils.core import setup, Extension +from setuptools import setup, find_packages, Extension import subprocess +import os -sr_includes = subprocess.check_output( - ["pkg-config", "--cflags", "libsigrok"]).rstrip().split(' ') +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")] -sr_libs = subprocess.check_output( - ["pkg-config", "--libs", "libsigrok"]).rstrip().split(' ') - -sr_version = subprocess.check_output( - ["pkg-config", "--version", "libsigrok"]).rstrip() +includes = ['../../include', '../cxx/include'] + [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'] setup( name = 'libsigrok', + namespace_packages = ['sigrok'], + packages = find_packages(), version = sr_version, description = "libsigrok API wrapper", - py_modules = ['libsigrok'], + zip_safe = False, ext_modules = [ - Extension('_libsigrok', - sources = ['libsigrok_python.i'], - swig_opts = sr_includes, - include_dirs = [i[2:] for i in sr_includes if i.startswith('-I')], - library_dirs = [l[2:] for l in sr_libs if l.startswith('-L')], - libraries = [l[2:] for l in sr_libs if l.startswith('-l')] - ) + Extension('sigrok.core._classes', + sources = ['sigrok/core/classes.i'], + swig_opts = ['-c++', '-threads'] + + ['-I%s' % i for i in includes], + extra_compile_args = ['-std=c++11'], + include_dirs = includes, + library_dirs = libdirs, + libraries = libs) ], )