def libsemigroups_version(): # the try-except is require pkgconfig v1.5.0 which is very recent, and # hence not on conda at time of writing. try: return pkgconfig.modversion("libsemigroups") except AttributeError: return minimum_libsemigroups_version()
def libsemigroups_version(): # the try-except is require pkgconfig v1.5.0 which is very recent, and # hence not on conda at time of writing. try: v = pkgconfig.modversion("libsemigroups") except AttributeError: # this is just the guts of the modversion method in pkgconfig v1.5.1 v = pkgconfig.pkgconfig._query("libsemigroups", "--modversion") if re.search("\d+\.\d+\.\d+-\d+-\w{7}", v): # i.e. supplied is of the form: 1.1.0-6-g8b04c08 v = re.search("\d+\.\d\.+\d+-\d+", v).group(0) return v
def libsemigroups_version(): "Get the version of libsemigroups installed using pkg-config." # the try-except is require pkgconfig v1.5.0 which is very recent, and # hence not on conda at time of writing. try: vers = pkgconfig.modversion("libsemigroups") except AttributeError: # this is just the guts of the modversion method in pkgconfig v1.5.1 vers = pkgconfig.pkgconfig._query( # pylint: disable=protected-access "libsemigroups", "--modversion") if re.search(r"\d+\.\d+\.\d+-\d+-\w{7}", vers): # i.e. supplied is of the form: 1.1.0-6-g8b04c08 vers = re.search(r"\d+\.\d\.+\d+-\d+", vers).group(0) return vers
def test_modversion(): assert pkgconfig.modversion(PACKAGE_NAME) == '3.2.1' assert pkgconfig.modversion('fake-openssl') == '1.1.0j' with pytest.raises(pkgconfig.PackageNotFoundError): pkgconfig.modversion('doesnotexist')
# pkgconfig 1.5+ has modversion ... otherwise, use a small shim try: from pkgconfig import modversion except ImportError: def modversion(package): # will need updating once we hit 8.20 :( for i in range(20, 3, -1): if pkgconfig.installed(package, '>= 8.' + str(i)): # be careful micro version is always set to 0 return '8.' + str(i) + '.0' return '8.2.0' major, minor, micro = [int(s) for s in modversion('vips').split('.')] features = { 'major': major, 'minor': minor, 'micro': micro, 'api': True, } from pyvips import decls # handy for debugging #with open('vips-source.txt','w') as f: # c = decls.cdefs(features) # f.write(c)
__LIBSEMIGROUPS_VERSION = "1.0.7" if "PKG_CONFIG_PATH" not in os.environ: os.environ["PKG_CONFIG_PATH"] = "" pkg_config_path = os.environ["PKG_CONFIG_PATH"].split(":") if "/usr/local/lib/pkgconfig" not in pkg_config_path: os.environ["PKG_CONFIG_PATH"] += ":/usr/local/lib/pkgconfig" if not pkgconfig.exists("libsemigroups"): raise ImportError("cannot locate libsemigroups library") elif pkgconfig.installed("libsemigroups", "< " + __LIBSEMIGROUPS_VERSION): raise ImportError( "libsemigroups version {0} is required, found {1}".format( __LIBSEMIGROUPS_VERSION, pkgconfig.modversion("libsemigroups"))) import cppyy import sys cppyy.gbl path = os.environ["PATH"].split(":") for d in path: if d.find("include") != -1: try: cppyy.add_include_path(d) except: pass stderr, sys.stderr = sys.stderr, open(os.devnull, "w")
if not pkgconfig.exists('aqbanking'): sys.stderr.write( 'Need aqbanking development package installed for compilation.' + os.linesep) sys.exit(1) else: for library in libraries: depCompilationArgs += pkgconfig.cflags(library).split(' ') depCompilationArgs += pkgconfig.libs(library).split(' ') libPath = pkgconfig.variables(library)['libdir'] if libPath not in depLibraryDirs: depLibraryDirs.append(libPath) # furthermore remember the c++ gui! if StrictVersion( pkgconfig.modversion('aqbanking').replace('beta', '').replace( 'alpha', '')) >= StrictVersion('5.8.1'): depCompilationArgs.append('-DSUPPORT_APPREGISTRATION') depCompilationArgs += [ '-DFINTS_REGISTRATION_KEY="8DEDB89E7B0F7DAE207CB948C"' ] sys.stderr.write('FinTS App registration enabled' + os.linesep) else: sys.stderr.write('FinTS App registration disabled' + os.linesep) depCompilationArgs += ['-DFENQUEJOB'] if '--debug' in sys.argv: depCompilationArgs += [ '-O0', '-g', '-std=gnu++11', '-Wunused-function', '-DDEBUGSTDERR' ] module1 = Extension(
def minor_libnm_version(): version = pkgconfig.modversion('libnm') version = version.split('.') return (int(version[0]), int(version[1]))
def test_modversion(): assert pkgconfig.modversion(PACKAGE_NAME) == '3.2.1'