mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-06 20:10:08 +01:00
Merge branch 'fix-base_prefix'
This commit is contained in:
4
setup.py
4
setup.py
@@ -105,7 +105,7 @@ class wx_build(orig_build):
|
||||
'message and the wxWidgets and Phoenix build steps in the future.\n')
|
||||
|
||||
# Use the same Python that is running this script.
|
||||
cmd = [sys.executable, '-u', 'build.py', 'build']
|
||||
cmd = ['"{}"'.format(sys.executable), '-u', 'build.py', 'build']
|
||||
cmd = ' '.join(cmd)
|
||||
runcmd(cmd)
|
||||
|
||||
@@ -219,7 +219,7 @@ class wx_install(orig_install):
|
||||
class wx_sdist(orig_sdist):
|
||||
def run(self):
|
||||
# Use build.py to perform the sdist
|
||||
cmd = [sys.executable, '-u', 'build.py', 'sdist']
|
||||
cmd = ['"{}"'.format(sys.executable), '-u', 'build.py', 'sdist']
|
||||
cmd = ' '.join(cmd)
|
||||
runcmd(cmd)
|
||||
|
||||
|
||||
49
wscript
49
wscript
@@ -332,20 +332,13 @@ def my_check_python_headers(conf):
|
||||
|
||||
if isWindows:
|
||||
libname = 'python' + conf.env['PYTHON_VERSION'].replace('.', '')
|
||||
|
||||
libpath = [os.path.join(dct['prefix'], "libs")]
|
||||
|
||||
# If we're running in a Py3 style venv then the libpath above is not
|
||||
# correct, it needs to come from sys.base_prefix instead.
|
||||
base_prefix = conf.get_python_variables(
|
||||
["base_prefix"],
|
||||
["import sys",
|
||||
"base_prefix = getattr(sys, 'base_prefix')"])[0]
|
||||
if base_prefix is not None:
|
||||
if dct['LIBDIR'] and os.path.isdir(dct['LIBDIR']):
|
||||
libpath = [dct['LIBDIR']]
|
||||
else:
|
||||
base_prefix = get_windows_base_prefix(conf, dct['prefix'])
|
||||
libpath = [os.path.join(base_prefix, "libs")]
|
||||
|
||||
# TODO: handle old-style virtualenv too
|
||||
|
||||
conf.env['LIBPATH_PYEMBED'] = libpath
|
||||
conf.env.append_value('LIB_PYEMBED', [libname])
|
||||
conf.env['LIBPATH_PYEXT'] = conf.env['LIBPATH_PYEMBED']
|
||||
@@ -408,6 +401,40 @@ def my_check_python_headers(conf):
|
||||
env.append_value('LINKFLAGS_PYEXT', dist_compiler.ldflags_shared)
|
||||
|
||||
|
||||
def get_windows_base_prefix(conf, default):
|
||||
# If the python being used for the build in running from a virtual
|
||||
# environment then sys.prefix will not be the correct path to find
|
||||
# the Python libs folder.
|
||||
import waflib.Errors
|
||||
|
||||
# If we're running in a Py3 style venv then there is a
|
||||
# sys.base_prefix we can use instead.
|
||||
try:
|
||||
base_prefix = conf.get_python_variables(
|
||||
["base_prefix"],
|
||||
["import sys",
|
||||
"base_prefix = getattr(sys, 'base_prefix')"])[0]
|
||||
return base_prefix
|
||||
except waflib.Errors.WafError:
|
||||
pass
|
||||
|
||||
# Otherwise try importing a python library module that should
|
||||
# always be in the Lib folder (at least for the versions of Python
|
||||
# we're interested in) and use it's location to figure out the
|
||||
# real prefix;
|
||||
# TODO: There has got to be a better way to do this!
|
||||
try:
|
||||
base_prefix = conf.get_python_variables(
|
||||
["base_prefix"],
|
||||
["import os.path as op",
|
||||
"import base64",
|
||||
"base_prefix = op.dirname(op.dirname(base64.__file__))"])[0]
|
||||
return base_prefix
|
||||
except waflib.Errors.WafError:
|
||||
pass
|
||||
|
||||
return default
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Build command
|
||||
|
||||
Reference in New Issue
Block a user