How to use envpython method in tox

Best Python code snippet using tox_python

SConstruct

Source:SConstruct Github

copy

Full Screen

1version = '0.0.1'2import os, platform, SCons3from distutils.version import LooseVersion4vars = Variables('custom.py')5vars.Add(BoolVariable('debug', 'compile with debug flags', 'no'))6vars.Add(BoolVariable('edebug', 'compile with extreme debug logs', 'no'))7vars.Add(BoolVariable('python2', 'use Python2.7 instead of Python3', 'no'))8vars.Add('installDir', 'directory where to install Pandora', '/usr/local/pandora')9if platform.system()=='Linux':10 vars.Add(PathVariable('hdf5', 'Path where HDF5 library was installed', '/usr/local/hdf5', PathVariable.PathIsDir))11env = Environment(variables=vars, ENV=os.environ, CXX='mpicxx')12if env['debug'] == False:13 env.VariantDir('build', '.')14else:15 env.VariantDir('buildDebug', '.')16Help(vars.GenerateHelpText(env))17env.Append(LIBS = 'pthread gdal hdf5 z tinyxml boost_filesystem boost_system boost_timer boost_chrono gomp mpl dl'.split())18env.Append(CCFLAGS = '-DTIXML_USE_STL -fopenmp -std=c++0x')19if platform.system()=='Darwin':20 env.Append(CCFLAGS = '-cxx=g++-4.8')21 env.Append(LINKFLAGS = '-undefined warning')22if env['debug'] == True:23 env.Append(CCFLAGS = '-g -Wall -DPANDORADEBUG')24 if env['edebug']==True:25 env.Append(CCFLAGS = '-DPANDORAEDEBUG')26 libraryName = 'pandorad.so'27 pythonLibraryName = 'pyPandorad.so'28else:29 env.Append(CCFLAGS = '-Ofast')30 libraryName = 'pandora.so'31 pythonLibraryName = 'pyPandora.so'32coreFiles = [str(f) for f in Glob('src/*.cxx')]33analysisFiles = [str(f) for f in Glob('src/analysis/*.cxx')]34srcFiles = coreFiles + analysisFiles35coreHeaders = [str(f) for f in Glob('include/*.hxx')]36analysisHeaders = [str(f) for f in Glob('include/analysis/*.hxx')]37if env['debug'] == False:38 srcBaseFiles = ['build/' + src for src in srcFiles]39else:40 srcBaseFiles = ['buildDebug/' + src for src in srcFiles]41env.Append(CPPPATH = 'include include/analysis'.split())42if platform.system()=='Linux':43 env.Append(CPPPATH = [env['hdf5']+'/include', '/usr/include/gdal/'])44 env.Append(CPPPATH = [env['hdf5']+'/include'])45 env.Append(LIBPATH = [env['hdf5']+'/lib'])46elif platform.system()=='Darwin':47 env.Append(LIBPATH = '/usr/local/lib')48envPython = env.Clone()49if platform.system()=='Linux':50 envPython.Append(LINKFLAGS = '-Wl,--export-dynamic,-no-undefined'.split())51if env['debug'] == False:52 envPython.VariantDir('build_py', '.')53 srcPyFiles = ['build_py/' + src for src in srcFiles]54else: 55 envPython.VariantDir('buildDebug_py', '.')56 srcPyFiles = ['buildDebug_py/' + src for src in srcFiles]57srcPyFiles += [str(f) for f in Glob('src/pyPandora/*.cxx')]58srcPyFiles += [str(f) for f in Glob('utils/*.cxx')]59conf = Configure(envPython)60if(env['python2']==False):61 envPython.ParseConfig("python3-config --includes --ldflags")62 if conf.CheckLib('boost_python-py33'):63 envPython.Append(LIBS = 'boost_python-py33')64 elif conf.CheckLib('boost_python-py34'):65 envPython.Append(LIBS = 'boost_python-py34')66 else:67 envPython.Append(LIBS = 'boost_python3') 68else:69 envPython.ParseConfig("python-config --includes --ldflags")70 if conf.CheckLib('boost_python-py27'):71 envPython.Append(LIBS = 'boost_python-py27')72 else:73 envPython.Append(LIBS = 'boost_python') 74envPython = conf.Finish()75# versioned lib do not create correct links with .so in osx76if platform.system()=='Linux':77 sharedPyLib = envPython.SharedLibrary('lib/'+pythonLibraryName, srcPyFiles, SHLIBVERSION=version)78 sharedLib = env.SharedLibrary('lib/'+libraryName, srcBaseFiles, SHLIBVERSION=version)79elif platform.system()=='Darwin':80 sharedPyLib = envPython.SharedLibrary('lib/'+pythonLibraryName, srcPyFiles)81 sharedLib = env.SharedLibrary('lib/'+libraryName, srcBaseFiles)82# installation83installLibDir = env['installDir'] + '/lib/'84installHeadersDir = env['installDir'] + '/include/'85installAnalysisHeadersDir = installHeadersDir+'analysis'86installedLib = ""87installedPyLib = ""88if(LooseVersion(SCons.__version__) < LooseVersion("2.3.0")):89 installedLib = env.Install(installLibDir, sharedLib, SHLIBVERSION=version)90 installedPyLib = env.Install(installLibDir, sharedPyLib, SHLIBVERSION=version)91else:92 installedLib = env.InstallVersionedLib(installLibDir, sharedLib, SHLIBVERSION=version)93 installedPyLib = env.InstallVersionedLib(installLibDir, sharedPyLib, SHLIBVERSION=version)94installedHeaders = env.Install(installHeadersDir, coreHeaders)95installedAnalysisHeaders = env.Install(installAnalysisHeadersDir, analysisHeaders)96installBin = env.Install(env['installDir'], Glob('./bin'))97installShare = env.Install(env['installDir'], Glob('./share'))98installMpiStub = env.Install(env['installDir']+'/utils', Glob('./utils/*.cxx'))99# cassandra100cassandraCompilation = env.Command("bin/cassandra", "", "cd cassandra && qmake && make")101if platform.system()=='Darwin':102 cassandraCompilation = env.Command("bin/cassandra", "", "cd cassandra && qmake cassandra_osx.pro && make")103# final targets104Default(sharedLib)105Default(sharedPyLib)106env.Alias('cassandra', cassandraCompilation)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tox automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful