Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fengzch-das
multibuild
Commits
79fdca95
Commit
79fdca95
authored
Mar 11, 2019
by
robbuckley
Browse files
fix build flags to 64b-only for PyPy
parent
4c993575
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
35 deletions
+77
-35
configure_build.sh
configure_build.sh
+1
-1
osx_utils.sh
osx_utils.sh
+57
-18
tests/test_multibuild.sh
tests/test_multibuild.sh
+1
-0
tests/test_osx_utils.sh
tests/test_osx_utils.sh
+12
-5
tests/test_python_install.sh
tests/test_python_install.sh
+6
-11
No files found.
configure_build.sh
View file @
79fdca95
...
@@ -16,7 +16,7 @@ BUILD_PREFIX="${BUILD_PREFIX:-/usr/local}"
...
@@ -16,7 +16,7 @@ BUILD_PREFIX="${BUILD_PREFIX:-/usr/local}"
# IS_OSX is defined in common_utils.sh
# IS_OSX is defined in common_utils.sh
if
[
-n
"
$IS_OSX
"
]
;
then
if
[
-n
"
$IS_OSX
"
]
;
then
source
$MULTIBUILD_DIR
/osx_utils.sh
source
$MULTIBUILD_DIR
/osx_utils.sh
PLAT
=
$(
mac
_c
python_arch_for_
osx_ver
)
PLAT
=
$(
macpython_arch_for_
version
$MB_PYTHON_VERSION
)
if
[[
$PLAT
==
intel
]]
;
then
if
[[
$PLAT
==
intel
]]
;
then
ARCH_FLAGS
=
${
ARCH_FLAGS
:-
"-arch i386 -arch x86_64"
}
ARCH_FLAGS
=
${
ARCH_FLAGS
:-
"-arch i386 -arch x86_64"
}
elif
[[
$PLAT
==
x86_64
]]
;
then
elif
[[
$PLAT
==
x86_64
]]
;
then
...
...
osx_utils.sh
View file @
79fdca95
...
@@ -170,25 +170,63 @@ function get_macpython_osx_ver {
...
@@ -170,25 +170,63 @@ function get_macpython_osx_ver {
fi
fi
}
}
function
mac
_c
python_arch_for_
osx_ver
{
function
macpython_arch_for_
version
{
# echo arch (intel or x86_64)
for CPython python.org builds targetted for
# echo arch (
e.g.
intel or x86_64)
that a version of CPython is expected
# t
he
given minimum macOS version
# t
o be built for,
given
the
minimum macOS version
# Parameters
# Parameters
# $py_osx_ver (major.minor | not defined}
# $py_ver Python version, e.g. (major.minor.patch) for CPython,
# the macosx version that Python is built for, e.g.
# or pypy-(major.minor) for PyPy
# "10.6" or "10.9", or MB_PYTHON_OSX_VER if undefined
# $py_osx_ver minimum macOS version the target Python is built for
#
local
py_ver
=
$1
py_osx_ver
=
${
1
:-
$MB_PYTHON_OSX_VER
}
local
py_osx_ver
=
${
2
:-
$MB_PYTHON_OSX_VER
}
if
[[
"
$py_osx_ver
"
==
"10.6"
]]
;
then
check_var
$1
echo
"intel"
if
[[
$(
macpython_impl_for_version
$py_ver
)
==
"cp"
]]
;
then
elif
[[
"
$py_osx_ver
"
==
"10.9"
]]
;
then
if
[[
"
$py_osx_ver
"
==
"10.6"
]]
;
then
echo
"intel"
elif
[[
"
$py_osx_ver
"
==
"10.9"
]]
;
then
echo
"x86_64"
else
echo
"Unexpected CPython osx version:
${
py_osx_ver
}
, supported values: 10.6 and 10.9"
exit
1
fi
else
echo
"x86_64"
echo
"x86_64"
fi
}
function
macpython_impl_for_version
{
# echo Python implementation (cp for CPython, pp for PyPy) given a
# suitably formatted version string
# Parameters:
# $version : [implementation-]major[.minor[.patch]]
# Python implementation, e.g. "3.6" for CPython or
# "pypy-5.4" for PyPy
local
version
=
$1
check_var
$1
if
[[
"
$version
"
=
~ pypy-
([
0-9
\.
]
+
)
]]
;
then
echo
pp
elif
[[
"
$version
"
=
~
([
0-9
\.
]
+
)
]]
;
then
echo cp
else
else
echo
"Unexpected python osx version:
${
py_osx_ver
}
, supported values: 10.6 and 10.9"
echo
"config error: Issue parsing this implementation in install_python:"
echo
" version=
$version
"
exit
1
exit
1
fi
fi
}
}
function
strip_macpython_ver_prefix
{
# strip the implementation prefix from a Python version string
# Parameters:
# $version : [implementation-]major[.minor[.patch]]
# Python implementation, e.g. "3.6" for CPython or
# "pypy-5.4" for PyPy
local
version
=
$1
check_var
$1
if
[[
"
$version
"
=
~
(
pypy-
)
?
([
0-9
\.
]
+
)
]]
;
then
echo
${
BASH_REMATCH
[2]
}
fi
}
function
install_macpython
{
function
install_macpython
{
# Install Python and set $PYTHON_EXE to the installed executable
# Install Python and set $PYTHON_EXE to the installed executable
# Parameters:
# Parameters:
...
@@ -199,13 +237,14 @@ function install_macpython {
...
@@ -199,13 +237,14 @@ function install_macpython {
# "10.6" or "10.9". Ignored for PyPy
# "10.6" or "10.9". Ignored for PyPy
local
version
=
$1
local
version
=
$1
local
py_osx_ver
=
$2
local
py_osx_ver
=
$2
if
[[
"
$version
"
=
~ pypy-
([
0-9
\.
]
+
)
]]
;
then
local
impl
=
$(
macpython_impl_for_version
$version
)
install_mac_pypy
"
${
BASH_REMATCH
[1]
}
"
local
stripped_ver
=
$(
strip_macpython_ver_prefix
$version
)
elif
[[
"
$version
"
=
~
([
0-9
\.
]
+
)
]]
;
then
if
[[
"
$impl
"
==
"pp"
]]
;
then
install_mac_cpython
"
${
BASH_REMATCH
[1]
}
"
$py_osx_ver
install_mac_pypy
$stripped_ver
elif
[[
"
$impl
"
==
"cp"
]]
;
then
install_mac_cpython
$stripped_ver
$py_osx_ver
else
else
echo
"config error: Issue parsing this implementation in install_python:"
echo
"Unexpected Python impl:
${
impl
}
"
echo
" version=
$version
"
exit
1
exit
1
fi
fi
}
}
...
...
tests/test_multibuild.sh
View file @
79fdca95
...
@@ -19,6 +19,7 @@ else
...
@@ -19,6 +19,7 @@ else
fi
fi
if
[
-n
"
$TEST_BUILDS
"
]
;
then
if
[
-n
"
$TEST_BUILDS
"
]
;
then
if
[
-n
"
$IS_OSX
"
]
;
then
if
[
-n
"
$IS_OSX
"
]
;
then
MB_PYTHON_VERSION
=
${
MB_PYTHON_VERSION
:-
$PYTHON_VERSION
}
source
tests/test_library_builders.sh
source
tests/test_library_builders.sh
elif
[
!
-x
"
$(
command
-v
docker
)
"
]
;
then
elif
[
!
-x
"
$(
command
-v
docker
)
"
]
;
then
echo
"Skipping build tests; no docker available"
echo
"Skipping build tests; no docker available"
...
...
tests/test_osx_utils.sh
View file @
79fdca95
...
@@ -24,14 +24,21 @@
...
@@ -24,14 +24,21 @@
[
"
$(
get_py_mm
)
"
==
"
${
cpython_version
:0:3
}
"
]
||
ingest
[
"
$(
get_py_mm
)
"
==
"
${
cpython_version
:0:3
}
"
]
||
ingest
[
"
$(
get_py_mm_nodot
)
"
==
$(
echo
"
${
cpython_version
:0:3
}
"
|
tr
-d
.
)
]
||
ingest
[
"
$(
get_py_mm_nodot
)
"
==
$(
echo
"
${
cpython_version
:0:3
}
"
|
tr
-d
.
)
]
||
ingest
# test lookup of arch from
C
Python mac
OS
target build
# test lookup of arch from Python mac
os
target build
[
"
$(
mac
_c
python_arch_for_
osx_ver
10.6
)
"
==
"intel"
]
||
ingest
[
"
$(
macpython_arch_for_
version 2.7
10.6
)
"
==
"intel"
]
||
ingest
[
"
$(
mac
_c
python_arch_for_
osx_ver
10.9
)
"
==
"x86_64"
]
||
ingest
[
"
$(
macpython_arch_for_
version 2.7
10.9
)
"
==
"x86_64"
]
||
ingest
[
"
$(
macpython_arch_for_version pypy-2.7
)
"
==
"x86_64"
]
||
ingest
# test lookup of arch / min macOS versions from installed python distutils tag
[
"
$(
get_macpython_arch macosx-10.6-intel
)
"
==
"intel"
]
||
ingest
[
"
$(
get_macpython_arch macosx-10.6-intel
)
"
==
"intel"
]
||
ingest
[
"
$(
get_macpython_arch macosx-10.6-x86_64
)
"
==
"x86_64"
]
||
ingest
[
"
$(
get_macpython_arch macosx-10.6-x86_64
)
"
==
"x86_64"
]
||
ingest
[
"
$(
get_macpython_osx_ver macosx-10.6-intel
)
"
==
"10.6"
]
||
ingest
[
"
$(
get_macpython_osx_ver macosx-10.6-intel
)
"
==
"10.6"
]
||
ingest
# test utilities for extracting version and impl from Python version string
[
"
$(
strip_macpython_ver_prefix 3.7.2
)
"
==
"3.7.2"
]
||
ingest
[
"
$(
strip_macpython_ver_prefix pypy-5.4
)
"
==
"5.4"
]
||
ingest
[
"
$(
macpython_impl_for_version 3.7.2
)
"
==
"cp"
]
||
ingest
[
"
$(
macpython_impl_for_version pypy-5.4
)
"
==
"pp"
]
||
ingest
# Test pkg-config install
# Test pkg-config install
install_pkg_config
install_pkg_config
\ No newline at end of file
tests/test_python_install.sh
View file @
79fdca95
...
@@ -61,17 +61,12 @@ else # not virtualenv
...
@@ -61,17 +61,12 @@ else # not virtualenv
fi
fi
fi
fi
#
for CPython,
check macOS version and arch are as expected
# check macOS version and arch are as expected
distutils_plat
=
$(
$PYTHON_EXE
-c
"import distutils.util; print(distutils.util.get_platform())"
)
distutils_plat
=
$(
$PYTHON_EXE
-c
"import distutils.util; print(distutils.util.get_platform())"
)
echo
"Python cmd archs:
$(
lipo
-info
$(
which
$PYTHON_EXE
))
"
expected_arch
=
$(
macpython_arch_for_version
$PYTHON_VERSION
)
if
[[
$requested_impl
=
'cp'
]]
;
then
if
[[
$requested_impl
==
'cp'
]]
;
then
echo
"CPython, checking platform..."
expected_tag
=
"macosx-
$MB_PYTHON_OSX_VER
-
$expected_arch
"
expected_tag
=
"macosx-
${
MB_PYTHON_OSX_VER
}
-
$(
mac_cpython_arch_for_osx_ver
)
"
if
!
[[
$distutils_plat
==
$expected_tag
]]
;
then
ingest
"Wrong Python platform tag:
${
distutils_plat
}
!=
${
expected_tag
}
"
fi
elif
[[
$requested_impl
=
'py'
]]
;
then
echo
"PyPy, skipping platform check..."
else
else
ingest
"Invalid impl: '
${
requested_impl
}
', expecting 'cp' or 'py'
"
expected_tag
=
"macosx-(10.[0-9]+)-
$expected_arch
"
fi
fi
[[
$distutils_plat
=
~
$expected_tag
]]
||
ingest
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment