Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
maestro-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
maestro
maestro-core
Commits
4fdd583f
Commit
4fdd583f
authored
Nov 2, 2022
by
Utz-Uwe Haus
Browse files
Options
Downloads
Patches
Plain Diff
Fix configure-time python discovery
parent
5c82d73e
No related branches found
No related tags found
1 merge request
!24
Draft: Resolve "scripting interface to maestro core"
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
configure.ac
+4
-2
4 additions, 2 deletions
configure.ac
m4/ax_python_devel.m4
+61
-14
61 additions, 14 deletions
m4/ax_python_devel.m4
with
65 additions
and
16 deletions
configure.ac
+
4
−
2
View file @
4fdd583f
...
@@ -614,7 +614,9 @@ AX_PKG_SWIG([3],[],
...
@@ -614,7 +614,9 @@ AX_PKG_SWIG([3],[],
[AC_MSG_NOTICE([SWIG not found, will not build python interface.])])
[AC_MSG_NOTICE([SWIG not found, will not build python interface.])])
AM_CONDITIONAL([WITH_SWIG], [test "x$SWIG" != "x"])
AM_CONDITIONAL([WITH_SWIG], [test "x$SWIG" != "x"])
AS_IF([test "x$SWIG" != "x"],[
AS_IF([test "x$SWIG" != "x"],[
AM_PATH_PYTHON([3])
dnl Find a sufficiently recent python, then have swig magically find it from the cache (AX_SWIG_PYTHON has no python version parameter)
AM_PATH_PYTHON([3.6]) # "Something reasonable recent" -- no hard investigation went into selecting .6
AX_PYTHON_DEVEL
dnl AX_SWIG_MULTI_MODULE_SUPPORT
dnl AX_SWIG_MULTI_MODULE_SUPPORT
AX_SWIG_PYTHON
AX_SWIG_PYTHON
])
])
...
...
This diff is collapsed.
Click to expand it.
m4/ax_python_devel.m4
+
61
−
14
View file @
4fdd583f
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
# modified version of the Autoconf Macro, you may extend this special
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
# exception to the GPL to apply to your modified version as well.
#serial
2
3
#serial 3
2
AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])
AU_ALIAS([AC_PYTHON_DEVEL], [AX_PYTHON_DEVEL])
AC_DEFUN([AX_PYTHON_DEVEL],[
AC_DEFUN([AX_PYTHON_DEVEL],[
...
@@ -112,13 +112,37 @@ to something else than an empty string.
...
@@ -112,13 +112,37 @@ to something else than an empty string.
fi
fi
#
#
# if the macro parameter ``version'' is set, honour it
# If the macro parameter ``version'' is set, honour it.
# A Python shim class, VPy, is used to implement correct version comparisons via
# string expressions, since e.g. a naive textual ">= 2.7.3" won't work for
# Python 2.7.10 (the ".1" being evaluated as less than ".3").
#
#
if test -n "$1"; then
if test -n "$1"; then
AC_MSG_CHECKING([for a version of Python $1])
AC_MSG_CHECKING([for a version of Python $1])
ac_supports_python_ver=`$PYTHON -c "import sys; \
cat << EOF > ax_python_devel_vpy.py
ver = sys.version.split ()[[0]]; \
class VPy:
def vtup(self, s):
return tuple(map(int, s.strip().replace("rc", ".").split(".")))
def __init__(self):
import sys
self.vpy = tuple(sys.version_info)
def __eq__(self, s):
return self.vpy == self.vtup(s)
def __ne__(self, s):
return self.vpy != self.vtup(s)
def __lt__(self, s):
return self.vpy < self.vtup(s)
def __gt__(self, s):
return self.vpy > self.vtup(s)
def __le__(self, s):
return self.vpy <= self.vtup(s)
def __ge__(self, s):
return self.vpy >= self.vtup(s)
EOF
ac_supports_python_ver=`$PYTHON -c "import ax_python_devel_vpy; \
ver = ax_python_devel_vpy.VPy(); \
print (ver $1)"`
print (ver $1)"`
rm -rf ax_python_devel_vpy*.py* __pycache__/ax_python_devel_vpy*.py*
if test "$ac_supports_python_ver" = "True"; then
if test "$ac_supports_python_ver" = "True"; then
AC_MSG_RESULT([yes])
AC_MSG_RESULT([yes])
else
else
...
@@ -208,7 +232,7 @@ EOD`
...
@@ -208,7 +232,7 @@ EOD`
ac_python_version=$PYTHON_VERSION
ac_python_version=$PYTHON_VERSION
else
else
ac_python_version=`$PYTHON -c "import sys; \
ac_python_version=`$PYTHON -c "import sys; \
print (sys.version[[:
3
]])"`
print (
"%d.%d" %
sys.version
_info
[[:
2
]])"`
fi
fi
fi
fi
...
@@ -271,8 +295,20 @@ EOD`
...
@@ -271,8 +295,20 @@ EOD`
AC_MSG_CHECKING([for Python site-packages path])
AC_MSG_CHECKING([for Python site-packages path])
if test -z "$PYTHON_SITE_PKG"; then
if test -z "$PYTHON_SITE_PKG"; then
if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
PYTHON_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \
PYTHON_SITE_PKG=`$PYTHON -c "
print (sysconfig.get_path('purelib'));"`
$IMPORT_SYSCONFIG;
if hasattr(sysconfig, 'get_default_scheme'):
scheme = sysconfig.get_default_scheme()
else:
scheme = sysconfig._get_default_scheme()
if scheme == 'posix_local':
# Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/
scheme = 'posix_prefix'
prefix = '$prefix'
if prefix == 'NONE':
prefix = '$ac_default_prefix'
sitedir = sysconfig.get_path('purelib', scheme, vars={'base': prefix})
print(sitedir)"`
else
else
# distutils.sysconfig way
# distutils.sysconfig way
PYTHON_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \
PYTHON_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \
...
@@ -286,10 +322,22 @@ EOD`
...
@@ -286,10 +322,22 @@ EOD`
# Check for platform-specific site packages
# Check for platform-specific site packages
#
#
AC_MSG_CHECKING([for Python platform specific site-packages path])
AC_MSG_CHECKING([for Python platform specific site-packages path])
if test -z "$PYTHON_SITE_PKG"; then
if test -z "$PYTHON_
PLATFORM_
SITE_PKG"; then
if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
if test "$IMPORT_SYSCONFIG" = "import sysconfig"; then
PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \
PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "
print (sysconfig.get_path('platlib'));"`
$IMPORT_SYSCONFIG;
if hasattr(sysconfig, 'get_default_scheme'):
scheme = sysconfig.get_default_scheme()
else:
scheme = sysconfig._get_default_scheme()
if scheme == 'posix_local':
# Debian's default scheme installs to /usr/local/ but we want to find headers in /usr/
scheme = 'posix_prefix'
prefix = '$prefix'
if prefix == 'NONE':
prefix = '$ac_default_prefix'
sitedir = sysconfig.get_path('platlib', scheme, vars={'platbase': prefix})
print(sitedir)"`
else
else
# distutils.sysconfig way
# distutils.sysconfig way
PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \
PYTHON_PLATFORM_SITE_PKG=`$PYTHON -c "$IMPORT_SYSCONFIG; \
...
@@ -331,7 +379,7 @@ EOD`
...
@@ -331,7 +379,7 @@ EOD`
ac_save_LIBS="$LIBS"
ac_save_LIBS="$LIBS"
ac_save_LDFLAGS="$LDFLAGS"
ac_save_LDFLAGS="$LDFLAGS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_CPPFLAGS="$CPPFLAGS"
LIBS="$ac_save_LIBS $PYTHON_LIBS
$PYTHON_EXTRA_LIBS
$PYTHON_EXTRA_LIBS"
LIBS="$ac_save_LIBS $PYTHON_LIBS $PYTHON_EXTRA_LIBS"
LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS"
LDFLAGS="$ac_save_LDFLAGS $PYTHON_EXTRA_LDFLAGS"
CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
AC_LANG_PUSH([C])
AC_LANG_PUSH([C])
...
@@ -366,4 +414,3 @@ EOD`
...
@@ -366,4 +414,3 @@ EOD`
# all done!
# all done!
#
#
])
])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment