Skip to content

Commit

Permalink
use distutils if it's available
Browse files Browse the repository at this point in the history
  • Loading branch information
terencehonles committed Oct 4, 2023
1 parent 8041fc2 commit 6f1eb19
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 28 deletions.
18 changes: 14 additions & 4 deletions plugins/asyncio/uwsgiplugin.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import os
import sysconfig

try:
from distutils import sysconfig as legacy
except ImportError:
legacy = None

def get_includes():
yield sysconfig.get_path('include')
yield sysconfig.get_path('platinclude')
if legacy:
yield sysconfig.get_python_inc()
yield sysconfig.get_python_inc(plat_specific=True)

NAME = 'asyncio'

CFLAGS = [
'-I' + sysconfig.get_path('include'),
'-I' + sysconfig.get_path('platinclude')
]
CFLAGS = ['-I' + i for i in filter(os.path.exists, get_includes())]
LDFLAGS = []
LIBS = []
GCC_LIST = ['asyncio']
19 changes: 15 additions & 4 deletions plugins/gevent/uwsgiplugin.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
import os
import sysconfig

try:
from distutils import sysconfig as legacy
except ImportError:
legacy = None

def get_includes():
yield sysconfig.get_path('include')
yield sysconfig.get_path('platinclude')
if legacy:
yield sysconfig.get_python_inc()
yield sysconfig.get_python_inc(plat_specific=True)


NAME = 'gevent'

CFLAGS = [
'-I' + sysconfig.get_path('include'),
'-I' + sysconfig.get_path('platinclude')
]
CFLAGS = ['-I' + i for i in filter(os.path.exists, get_includes())]
LDFLAGS = []
LIBS = []

Expand Down
18 changes: 14 additions & 4 deletions plugins/greenlet/uwsgiplugin.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import os
import sysconfig

try:
from distutils import sysconfig as legacy
except ImportError:
legacy = None

def get_includes():
yield sysconfig.get_path('include')
yield sysconfig.get_path('platinclude')
if legacy:
yield sysconfig.get_python_inc()
yield sysconfig.get_python_inc(plat_specific=True)

NAME = 'greenlet'

CFLAGS = [
'-I' + sysconfig.get_path('include'),
'-I' + sysconfig.get_path('platinclude')
]
CFLAGS = ['-I' + i for i in filter(os.path.exists, get_includes())]
LDFLAGS = []
LIBS = []

Expand Down
17 changes: 13 additions & 4 deletions plugins/python/uwsgiplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@

import sysconfig

try:
from distutils import sysconfig as legacy
except ImportError:
legacy = None

def get_includes():
yield sysconfig.get_path('include')
yield sysconfig.get_path('platinclude')
if legacy:
yield sysconfig.get_python_inc()
yield sysconfig.get_python_inc(plat_specific=True)


def get_python_version():
version = sysconfig.get_config_var('VERSION')
Expand Down Expand Up @@ -30,10 +42,7 @@ def get_python_version():
'raw'
]

CFLAGS = [
'-I' + sysconfig.get_path('include'),
'-I' + sysconfig.get_path('platinclude'),
]
CFLAGS = ['-I' + i for i in filter(os.path.exists, get_includes())]
LDFLAGS = []

if 'UWSGI_PYTHON_NOLIB' not in os.environ:
Expand Down
17 changes: 13 additions & 4 deletions plugins/pyuwsgi/uwsgiplugin.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import sysconfig
import os, sys

try:
from distutils import sysconfig as legacy
except ImportError:
legacy = None

def get_includes():
yield sysconfig.get_path('include')
yield sysconfig.get_path('platinclude')
if legacy:
yield sysconfig.get_python_inc()
yield sysconfig.get_python_inc(plat_specific=True)

os.environ['UWSGI_PYTHON_NOLIB'] = '1'

NAME = 'pyuwsgi'

CFLAGS = [
'-I' + sysconfig.get_path('include'),
'-I' + sysconfig.get_path('platinclude'),
]
CFLAGS = ['-I' + i for i in filter(os.path.exists, get_includes())]
LDFLAGS = []
LIBS = []

Expand Down
18 changes: 14 additions & 4 deletions plugins/stackless/uwsgiplugin.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import os
import sysconfig

try:
from distutils import sysconfig as legacy
except ImportError:
legacy = None

def get_includes():
yield sysconfig.get_path('include')
yield sysconfig.get_path('platinclude')
if legacy:
yield sysconfig.get_python_inc()
yield sysconfig.get_python_inc(plat_specific=True)

NAME = 'stackless'

CFLAGS = [
'-I' + sysconfig.get_path('include'),
'-I' + sysconfig.get_path('platinclude'),
]
CFLAGS = ['-I' + i for i in filter(os.path.exists, get_includes())]
LDFLAGS = []
LIBS = []

Expand Down
18 changes: 14 additions & 4 deletions plugins/tornado/uwsgiplugin.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import os
import sysconfig

try:
from distutils import sysconfig as legacy
except ImportError:
legacy = None

def get_includes():
yield sysconfig.get_path('include')
yield sysconfig.get_path('platinclude')
if legacy:
yield sysconfig.get_python_inc()
yield sysconfig.get_python_inc(plat_specific=True)

NAME = 'tornado'

CFLAGS = [
'-I' + sysconfig.get_path('include'),
'-I' + sysconfig.get_path('platinclude'),
]
CFLAGS = ['-I' + i for i in filter(os.path.exists, get_includes())]
LDFLAGS = []
LIBS = []

Expand Down

0 comments on commit 6f1eb19

Please sign in to comment.