try to understand how heroku installed python [8]

This commit is contained in:
Unbit
2013-02-23 11:53:47 +01:00
parent ac3ec1781e
commit 39260ebac0
+14 -11
View File
@@ -2,6 +2,14 @@ import os,sys
from distutils import sysconfig
def get_python_version():
version = sysconfig.get_config_var('VERSION')
try:
version = version + sys.abiflags
except:
pass
return version
NAME='python'
GCC_LIST = ['python_plugin', 'pyutils', 'pyloader', 'wsgi_handlers', 'wsgi_headers', 'wsgi_subhandler', 'web3_subhandler', 'pump_subhandler', 'gil', 'uwsgi_pymodule', 'profiler', 'symimporter', 'tracebacker']
@@ -14,16 +22,17 @@ LDFLAGS = []
if not 'UWSGI_PYTHON_NOLIB' in os.environ:
LIBS = sysconfig.get_config_var('LIBS').split() + sysconfig.get_config_var('SYSLIBS').split()
# check if it is a non-shared build (but please, add --enable-shared to your python's ./configure script)
if not sysconfig.get_config_var('Py_ENABLE_SHARED'):
libdir = sysconfig.get_config_var('LIBPL')
print("LIBDIR = %s" % libdir)
print(os.listdir(libdir))
print("BASE = %s" % sysconfig.get_config_var('base'))
# libdir does not exists, try to get it from the venv
if not os.path.exists(libdir):
libdir = sysconfig.get_config_var('srcdir')
libdir = '%s/lib/python%s/config' % (sysconfig.get_config_var('base'), get_python_version())
libpath = '%s/%s' % (libdir, sysconfig.get_config_var('LDLIBRARY'))
if not os.path.exists(libpath):
libpath = '%s/%s' % (libdir, sysconfig.get_config_var('LIBRARY'))
if not os.path.exists(libpath):
libpath = '%s/libpython%s.a' % (libdir, get_python_version())
LIBS.append(libpath)
else:
try:
@@ -33,12 +42,6 @@ if not 'UWSGI_PYTHON_NOLIB' in os.environ:
LDFLAGS.append("-L%s/lib" % sysconfig.PREFIX)
os.environ['LD_RUN_PATH'] = "%s/lib" % sysconfig.PREFIX
version = sysconfig.get_config_var('VERSION')
try:
version = version + sys.abiflags
except:
pass
LIBS.append('-lpython' + version)
LIBS.append('-lpython%s' % get_python_version())
else:
LIBS = []