Skip to content

Commit c7741a5

Browse files
mayeuthenryiii
authored andcommitted
feat: deploy a single py2.py3 wheel per platform
Add python 2.7 tests Check exactly 1 final wheel per build exists in ./dist Only rely on auditwheel to add manylinux* platform tags Remove dist-staging
1 parent 3bf06c7 commit c7741a5

File tree

5 files changed

+45
-47
lines changed

5 files changed

+45
-47
lines changed

.circleci/config.yml

+15-12
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ references:
2121
echo "MANYLINUX_PYTHON [${MANYLINUX_PYTHON}]"
2222
/opt/python/${MANYLINUX_PYTHON}/bin/pip install scikit-ci
2323
/opt/python/${MANYLINUX_PYTHON}/bin/ci
24+
if [ "${UPLOAD_SDIST}" == "tests-only" ]; then
25+
rm -f ./dist/*
26+
fi
2427
- persist_to_workspace:
2528
root: ./
2629
paths:
@@ -44,17 +47,17 @@ references:
4447
jobs:
4548

4649
# x64
47-
manylinux-x64_cp27-cp27mu:
48-
<<: *x64_build_job
4950
manylinux-x64_cp37-cp37m_upload-sdist:
5051
<<: *x64_build_job
5152

5253
# x86
53-
manylinux-x86_cp27-cp27mu:
54-
<<: *x86_build_job
5554
manylinux-x86_cp37-cp37m:
5655
<<: *x86_build_job
5756

57+
# python 2.7 tests
58+
manylinux-x64_cp27-cp27mu_tests-only:
59+
<<: *x64_build_job
60+
5861
deploy-master:
5962
docker:
6063
- image: circleci/python:3.7.0-stretch
@@ -87,35 +90,35 @@ workflows:
8790
build-test-deploy:
8891
jobs:
8992
# x64
90-
- manylinux-x64_cp27-cp27mu:
91-
<<: *no_filters
9293
- manylinux-x64_cp37-cp37m_upload-sdist:
9394
<<: *no_filters
9495
# x86
95-
- manylinux-x86_cp27-cp27mu:
96-
<<: *no_filters
9796
- manylinux-x86_cp37-cp37m:
9897
<<: *no_filters
9998

99+
# python 2.7 tests
100+
- manylinux-x64_cp27-cp27mu_tests-only:
101+
<<: *no_filters
102+
100103
- deploy-master:
101104
requires:
102105
# x64
103-
- manylinux-x64_cp27-cp27mu
104106
- manylinux-x64_cp37-cp37m_upload-sdist
105107
# x86
106-
- manylinux-x86_cp27-cp27mu
107108
- manylinux-x86_cp37-cp37m
109+
# python 2.7 test
110+
- manylinux-x64_cp27-cp27mu_tests-only
108111
filters:
109112
branches:
110113
only: master
111114
- deploy-release:
112115
requires:
113116
# x64
114-
- manylinux-x64_cp27-cp27mu
115117
- manylinux-x64_cp37-cp37m_upload-sdist
116118
# x86
117-
- manylinux-x86_cp27-cp27mu
118119
- manylinux-x86_cp37-cp37m
120+
# python 2.7 test
121+
- manylinux-x64_cp27-cp27mu_tests-only
119122
filters:
120123
tags:
121124
only: /^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$/

.travis.yml

-6
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ matrix:
1717
- PYTHON_VERSION=3.7.9
1818
- MACOSX_DEPLOYMENT_TARGET=10.10
1919

20-
- os: osx
21-
language: generic
22-
env:
23-
- PYTHON_VERSION=2.7.18
24-
- MACOSX_DEPLOYMENT_TARGET=10.10
25-
2620
- arch: arm64-graviton2
2721
virt: vm
2822
group: edge

appveyor.yml

-12
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@ version: "0.0.1.{build}"
88
environment:
99
matrix:
1010

11-
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
12-
PYTHON_DIR: "C:\\Python27"
13-
PYTHON_VERSION: "2.7.x"
14-
PYTHON_ARCH: "32"
15-
BLOCK: "0"
16-
17-
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
18-
PYTHON_DIR: "C:\\Python27-x64"
19-
PYTHON_VERSION: "2.7.x"
20-
PYTHON_ARCH: "64"
21-
BLOCK: "0"
22-
2311
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
2412
PYTHON_DIR: "C:\\Python37"
2513
PYTHON_VERSION: "3.7.x"

scikit-ci.yml

+9-11
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ before_install:
4949
import os
5050
import ci
5151
import platform
52-
os.environ["SETUP_BDIST_WHEEL_ARGS"] = "--plat-name %s" % os.environ["AUDITWHEEL_PLAT"]
5352
setup_cmake_args = []
5453
setup_cmake_args.append("-DSTRIP_EXECUTABLE:FILEPATH=/opt/rh/devtoolset-9/root/usr/" + "/bin/strip")
5554
if platform.machine() in {"aarch64", "ppc64le", "s390x"}:
@@ -95,22 +94,19 @@ build:
9594
- |
9695
# Since there are no external shared libraries to bundle into the wheels
9796
# this step will fixup the wheel switching from 'linux' to 'manylinux' tag
98-
for whl in dist/*linux*_$(arch).whl; do
99-
auditwheel repair --plat ${AUDITWHEEL_PLAT} $whl -w ./dist
97+
for whl in dist/*.whl; do
98+
auditwheel repair --plat ${AUDITWHEEL_PLAT} ${whl} -w ./dist/
99+
rm ${whl}
100100
done
101101
102102
circle:
103103
commands:
104104
- |
105-
arch=${AUDITWHEEL_ARCH}
106-
if [[ ${arch} == "aarch64" ]]; then
107-
exit
108-
fi
109105
# Since there are no external shared libraries to bundle into the wheels
110106
# this step will fixup the wheel switching from 'linux' to 'manylinux' tag
111-
for whl in dist/*linux_${arch}.whl; do
112-
auditwheel repair --plat ${AUDITWHEEL_PLAT} $whl -w ./dist/
113-
rm $whl
107+
for whl in dist/*.whl; do
108+
auditwheel repair --plat ${AUDITWHEEL_PLAT} ${whl} -w ./dist/
109+
rm ${whl}
114110
done
115111
116112
test:
@@ -139,7 +135,9 @@ test:
139135
additional_platforms.append("macosx_11_0_universal2")
140136
141137
for wheel in wheels:
142-
convert_to_generic_platform_wheel(wheel, remove_original=True, additional_platforms=additional_platforms)
138+
convert_to_generic_platform_wheel(wheel, remove_original=True, py2_py3=True, additional_platforms=additional_platforms)
139+
wheels = glob.glob("dist/*.whl")
140+
assert len(wheels) == 1, "There shall be exactly 1 final wheel per build"
143141
144142
appveyor:
145143
commands:

scripts/convert_to_generic_platform_wheel.py

+21-6
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def _to_generic_pyver(pyver_tags):
4141
return ['py%s' % tag[2] if tag.startswith('cp') else tag for tag in pyver_tags]
4242

4343

44-
def _convert_to_generic_platform_wheel(wheel_ctx, additional_platforms):
44+
def _convert_to_generic_platform_wheel(wheel_ctx, py2_py3, additional_platforms):
4545
"""Switch to generic python tags and remove ABI tags from a wheel
4646
4747
Convert implementation specific python tags to their generic equivalent and
@@ -51,6 +51,8 @@ def _convert_to_generic_platform_wheel(wheel_ctx, additional_platforms):
5151
----------
5252
wheel_ctx : InWheelCtx
5353
An open wheel context
54+
py2_py3: Bool
55+
Wether the pyver tag shall be py2.py3 or just the one inferred from the wheel name
5456
additional_platforms : Optional[Iterable[str]]
5557
An optional iterable of additional platform to add to the wheel
5658
"""
@@ -91,6 +93,10 @@ def _convert_to_generic_platform_wheel(wheel_ctx, additional_platforms):
9193
original_pyver_tags = fparts['pyver'].split('.')
9294
logger.debug('Previous pyver tags: %s', ', '.join(original_pyver_tags))
9395
pyver_tags = _to_generic_pyver(original_pyver_tags)
96+
if py2_py3:
97+
if len(set(["py2", "py3"]) & set(pyver_tags)) == 0:
98+
raise ValueError("pyver_tags does not contain py2 nor py3")
99+
pyver_tags = list(sorted(set(pyver_tags + ["py2", "py3"])))
94100
if pyver_tags != original_pyver_tags:
95101
logger.debug('New pyver tags ....: %s', ', '.join(pyver_tags))
96102
fparts['pyver'] = '.'.join(pyver_tags)
@@ -115,8 +121,7 @@ def _convert_to_generic_platform_wheel(wheel_ctx, additional_platforms):
115121

116122
# Python version, C-API version combinations
117123
pyc_apis = []
118-
for tag in in_info_tags:
119-
py_ver = '.'.join(_to_generic_pyver(tag.split('-')[0].split('.')))
124+
for py_ver in pyver_tags:
120125
abi = 'none'
121126
pyc_apis.append('-'.join([py_ver, abi]))
122127
# unique Python version, C-API version combinations
@@ -138,7 +143,7 @@ def _convert_to_generic_platform_wheel(wheel_ctx, additional_platforms):
138143

139144

140145
def convert_to_generic_platform_wheel(wheel_path, out_dir='./dist/', remove_original=False, verbose=0,
141-
additional_platforms=None):
146+
py2_py3=False, additional_platforms=None):
142147
logging.disable(logging.NOTSET)
143148
if verbose >= 1:
144149
logging.basicConfig(level=logging.DEBUG)
@@ -150,7 +155,7 @@ def convert_to_generic_platform_wheel(wheel_path, out_dir='./dist/', remove_orig
150155

151156
with InWheelCtx(wheel_path) as ctx:
152157
ctx.out_wheel = pjoin(out_dir, wheel_fname)
153-
ctx.out_wheel = _convert_to_generic_platform_wheel(ctx, additional_platforms)
158+
ctx.out_wheel = _convert_to_generic_platform_wheel(ctx, py2_py3, additional_platforms)
154159

155160
if remove_original:
156161
logger.info('Removed original wheel %s' % wheel_path)
@@ -179,13 +184,23 @@ def main():
179184
dest='remove_original',
180185
action='store_true',
181186
help='Remove original wheel')
187+
p.add_argument("--py2-py3",
188+
dest='py2_py3',
189+
action='store_true',
190+
help='Remove original wheel')
191+
p.add_argument("-p",
192+
"--add-platform",
193+
dest='additional_platforms',
194+
action="append",
195+
help='Add a platform tag')
182196

183197
args = p.parse_args()
184198

185199
if not isfile(args.WHEEL_FILE):
186200
p.error('cannot access %s. No such file' % args.WHEEL_FILE)
187201

188-
convert_to_generic_platform_wheel(args.WHEEL_FILE, args.WHEEL_DIR, args.remove_original, args.verbose)
202+
convert_to_generic_platform_wheel(args.WHEEL_FILE, args.WHEEL_DIR, args.remove_original, args.verbose,
203+
args.py2_py3, args.additional_platforms)
189204

190205

191206
if __name__ == '__main__':

0 commit comments

Comments
 (0)