Best Python code snippet using avocado_python
uwsgiplugin.py
Source:uwsgiplugin.py
1import os,sys2from distutils import sysconfig3def get_python_version():4 version = sysconfig.get_config_var('VERSION')5 try:6 version = version + sys.abiflags7 except:8 pass9 return version10NAME='python'11GCC_LIST = ['python_plugin', 'pyutils', 'pyloader', 'wsgi_handlers', 'wsgi_headers', 'wsgi_subhandler', 'web3_subhandler', 'pump_subhandler', 'gil', 'uwsgi_pymodule', 'profiler', 'symimporter', 'tracebacker', 'raw']12CFLAGS = ['-I' + sysconfig.get_python_inc(), '-I' + sysconfig.get_python_inc(plat_specific=True) ] 13LDFLAGS = []14if not 'UWSGI_PYTHON_NOLIB' in os.environ:15 LIBS = sysconfig.get_config_var('LIBS').split() + sysconfig.get_config_var('SYSLIBS').split()16 # check if it is a non-shared build (but please, add --enable-shared to your python's ./configure script)17 if not sysconfig.get_config_var('Py_ENABLE_SHARED'):18 libdir = sysconfig.get_config_var('LIBPL')19 # libdir does not exists, try to get it from the venv20 version = get_python_version()21 if not os.path.exists(libdir):22 libdir = '%s/lib/python%s/config' % (sys.prefix, version)23 # try skipping abiflag24 if not os.path.exists(libdir) and version.endswith('m'):25 version = version[:-1]26 libdir = '%s/lib/python%s/config' % (sys.prefix, version)27 # try 3.x style config dir28 if not os.path.exists(libdir):29 libdir = '%s/lib/python%s/config-%s' % (sys.prefix, version, get_python_version())30 # get cpu type31 uname = os.uname()32 if uname[4].startswith('arm'):33 libpath = '%s/%s' % (libdir, sysconfig.get_config_var('LIBRARY'))34 if not os.path.exists(libpath): 35 libpath = '%s/%s' % (libdir, sysconfig.get_config_var('LDLIBRARY'))36 else:37 libpath = '%s/%s' % (libdir, sysconfig.get_config_var('LDLIBRARY'))38 if not os.path.exists(libpath): 39 libpath = '%s/%s' % (libdir, sysconfig.get_config_var('LIBRARY'))40 if not os.path.exists(libpath): 41 libpath = '%s/libpython%s.a' % (libdir, version)42 LIBS.append(libpath)43 # hack for messy linkers/compilers44 if '-lutil' in LIBS:45 LIBS.append('-lutil')46 else:47 try:48 libdir = sysconfig.get_config_var('LIBDIR')49 except:50 libdir = "%s/lib" % sysconfig.PREFIX51 LDFLAGS.append("-L%s" % libdir)52 LDFLAGS.append("-Wl,-rpath,%s" % libdir)53 os.environ['LD_RUN_PATH'] = "%s" % libdir54 LIBS.append('-lpython%s' % get_python_version())55else:...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!