Skip to content

Commit 311dc89

Browse files
committed
Merge branch 'dev' into 3.7
2 parents bf1ed73 + 35313f8 commit 311dc89

File tree

9 files changed

+292
-140
lines changed

9 files changed

+292
-140
lines changed

.github/workflows/publish.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish support package
2+
3+
on:
4+
release:
5+
types: published
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up Python environment
13+
uses: actions/setup-python@v1
14+
with:
15+
python-version: "3.X"
16+
- name: Set build variables
17+
env:
18+
TAG_NAME: ${{ github.ref }}
19+
run: |
20+
export TAG=$(basename $TAG_NAME)
21+
echo "TAG=${TAG}"
22+
export TAG_VERSION="${TAG%-*}"
23+
export TAG_BUILD="${TAG#*-}"
24+
echo "PY_VERSION=${TAG_VERSION}"
25+
echo "BUILD_NUMBER=${TAG_BUILD}"
26+
echo "::set-env name=TAG::${TAG}"
27+
echo "::set-env name=PY_VERSION::${TAG_VERSION}"
28+
echo "::set-env name=BUILD_NUMBER::${TAG_BUILD}"
29+
- name: Update Release Asset to S3
30+
env:
31+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
32+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
33+
run: |
34+
python -m pip install -U pip
35+
python -m pip install -U setuptools
36+
python -m pip install awscli
37+
# macOS build
38+
curl -o macOS-artefact.tar.gz -L https://github.com/beeware/Python-Apple-support/releases/download/${{ env.TAG }}/Python-${{ env.PY_VERSION }}-macOS-support.${{ env.BUILD_NUMBER }}.tar.gz
39+
aws s3 cp macOS-artefact.tar.gz s3://briefcase-support/python/${{ env.PY_VERSION }}/macOS/Python-${{ env.PY_VERSION }}-macOS-support.${{ env.BUILD_NUMBER }}.tar.gz
40+
# iOS build
41+
curl -o iOS-artefact.tar.gz -L https://github.com/beeware/Python-Apple-support/releases/download/${{ env.TAG }}/Python-${{ env.PY_VERSION }}-iOS-support.${{ env.BUILD_NUMBER }}.tar.gz
42+
aws s3 cp iOS-artefact.tar.gz s3://briefcase-support/python/${{ env.PY_VERSION }}/iOS/Python-${{ env.PY_VERSION }}-iOS-support.${{ env.BUILD_NUMBER }}.tar.gz
43+
# tvOS build
44+
curl -o tvOS-artefact.tar.gz -L https://github.com/beeware/Python-Apple-support/releases/download/${{ env.TAG }}/Python-${{ env.PY_VERSION }}-tvOS-support.${{ env.BUILD_NUMBER }}.tar.gz
45+
aws s3 cp tvOS-artefact.tar.gz s3://briefcase-support/python/${{ env.PY_VERSION }}/tvOS/Python-${{ env.PY_VERSION }}-tvOS-support.${{ env.BUILD_NUMBER }}.tar.gz
46+
# watchOS build
47+
curl -o watchOS-artefact.tar.gz -L https://github.com/beeware/Python-Apple-support/releases/download/${{ env.TAG }}/Python-${{ env.PY_VERSION }}-watchOS-support.${{ env.BUILD_NUMBER }}.tar.gz
48+
aws s3 cp watchOS-artefact.tar.gz s3://briefcase-support/python/${{ env.PY_VERSION }}/watchOS/Python-${{ env.PY_VERSION }}-watchOS-support.${{ env.BUILD_NUMBER }}.tar.gz

.github/workflows/release.yaml

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# This is the DEV workflow.
2+
# Run this Action on creating a new tag matching "<version>-b<build>"
3+
# e.g., 3.7-b1
4+
name: Build support package
5+
on:
6+
push:
7+
tags:
8+
- '*-b*'
9+
10+
jobs:
11+
make-release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Set build variables
15+
env:
16+
TAG_NAME: ${{ github.ref }}
17+
run: |
18+
export TAG=$(basename $TAG_NAME)
19+
echo "TAG=${TAG}"
20+
export TAG_VERSION="${TAG%-*}"
21+
export TAG_BUILD="${TAG#*-}"
22+
echo "PY_VERSION=${TAG_VERSION}"
23+
echo "BUILD_NUMBER=${TAG_BUILD}"
24+
echo "::set-env name=TAG::${TAG}"
25+
echo "::set-env name=PY_VERSION::${TAG_VERSION}"
26+
echo "::set-env name=BUILD_NUMBER::${TAG_BUILD}"
27+
- name: Create Release
28+
id: create_release
29+
uses: actions/create-release@v1
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
with:
33+
tag_name: ${{ github.ref }}
34+
release_name: ${{ github.ref }}
35+
draft: true
36+
prerelease: false
37+
body: |
38+
Build ${{ env.BUILD_NUMBER }} of the BeeWare support package for Python ${{ env.PY_VERSION }}.
39+
40+
Includes:
41+
* Python ${{ env.PY_VERSION }}.?
42+
* ...
43+
outputs:
44+
upload_url: ${{ steps.create_release.outputs.upload_url }}
45+
46+
build:
47+
runs-on: macOS-latest
48+
needs: make-release
49+
strategy:
50+
max-parallel: 4
51+
matrix:
52+
target: ['macOS', 'iOS', 'tvOS', 'watchOS']
53+
steps:
54+
- uses: actions/checkout@v2
55+
- name: Set build variables
56+
env:
57+
TAG_NAME: ${{ github.ref }}
58+
run: |
59+
export TAG=$(basename $TAG_NAME)
60+
echo "TAG=${TAG}"
61+
export TAG_VERSION="${TAG%-*}"
62+
export TAG_BUILD="${TAG#*-}"
63+
echo "PY_VERSION=${TAG_VERSION}"
64+
echo "BUILD_NUMBER=${TAG_BUILD}"
65+
echo "::set-env name=TAG::${TAG}"
66+
echo "::set-env name=PY_VERSION::${TAG_VERSION}"
67+
echo "::set-env name=BUILD_NUMBER::${TAG_BUILD}"
68+
- name: Build ${{ matrix.target }}
69+
env:
70+
BUILD_NUMBER: ${{ env.BUILD_NUMBER }}
71+
run: |
72+
# 2020-05-29: The iOS 13.4 SDK changed the implementation of FD_SET
73+
# to use a weak linked symbol (__darwin_check_fd_set_overflow).
74+
# This means any support package built against that SDK is incompatible
75+
# with linking against an earlier SDK.
76+
# However, you can't get the iOS 13.4 SDK on macOS Mojave (10.14),
77+
# because the latest XCode supported on Mojave (11.3.1) only provided
78+
# SDK 13.2.
79+
# So: We force the use of XCode 11.3.1, which ships with the 13.2 SDK.
80+
# For a list of SDKs available on Github Actions, see:
81+
# https://github.com/actions/virtual-environments/blob/master/images/macos/macos-10.15-Readme.md
82+
sudo xcode-select --switch /Applications/Xcode_11.3.1.app
83+
make -e ${{ matrix.target }}
84+
- name: Upload ${{ matrix.target }} release asset
85+
uses: actions/upload-release-asset@v1
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
with:
89+
upload_url: ${{ needs.make-release.outputs.upload_url }}
90+
asset_path: ./dist/Python-${{ env.PY_VERSION }}-${{ matrix.target }}-support.${{ env.BUILD_NUMBER }}.tar.gz
91+
asset_name: Python-${{ env.PY_VERSION }}-${{ matrix.target }}-support.${{ env.BUILD_NUMBER }}.tar.gz
92+
asset_content_type: application/gzip

Makefile

+30-36
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# Current director
2626
PROJECT_DIR=$(shell pwd)
2727

28-
BUILD_NUMBER=3
28+
BUILD_NUMBER=custom
2929

3030
MACOSX_DEPLOYMENT_TARGET=10.8
3131

@@ -34,12 +34,12 @@ PYTHON_VERSION=3.7.6
3434
PYTHON_VER=$(basename $(PYTHON_VERSION))
3535

3636
OPENSSL_VERSION_NUMBER=1.1.1
37-
OPENSSL_REVISION=d
37+
OPENSSL_REVISION=g
3838
OPENSSL_VERSION=$(OPENSSL_VERSION_NUMBER)$(OPENSSL_REVISION)
3939

4040
BZIP2_VERSION=1.0.8
4141

42-
XZ_VERSION=5.2.4
42+
XZ_VERSION=5.2.5
4343

4444
# Supported OS
4545
OS=macOS iOS tvOS watchOS
@@ -50,20 +50,22 @@ CFLAGS-macOS=-mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET)
5050

5151
# iOS targets
5252
TARGETS-iOS=iphonesimulator.x86_64 iphoneos.arm64
53-
CFLAGS-iOS=-mios-version-min=8.0
54-
CFLAGS-iphoneos.arm64=-fembed-bitcode
55-
CFLAGS-iphonesimulator.x86_64=-fembed-bitcode
53+
CFLAGS-iOS=-mios-version-min=8.0 -fembed-bitcode
54+
CFLAGS-iphoneos.arm64=
55+
CFLAGS-iphonesimulator.x86_64=
5656

5757
# tvOS targets
5858
TARGETS-tvOS=appletvsimulator.x86_64 appletvos.arm64
59-
CFLAGS-tvOS=-mtvos-version-min=9.0
60-
CFLAGS-appletvos.arm64=-fembed-bitcode
59+
CFLAGS-tvOS=-mtvos-version-min=9.0 -fembed-bitcode
60+
CFLAGS-appletvos.arm64=
61+
CFLAGS-appletvsimulator.x86_64=
6162
PYTHON_CONFIGURE-tvOS=ac_cv_func_sigaltstack=no
6263

6364
# watchOS targets
6465
TARGETS-watchOS=watchsimulator.i386 watchos.armv7k
65-
CFLAGS-watchOS=-mwatchos-version-min=4.0
66-
CFLAGS-watchos.armv7k=-fembed-bitcode
66+
CFLAGS-watchOS=-mwatchos-version-min=4.0 -fembed-bitcode
67+
CFLAGS-watchsimulator.i386=
68+
CFLAGS-watchos.armv7k=
6769
PYTHON_CONFIGURE-watchOS=ac_cv_func_sigaltstack=no
6870

6971
# override machine types for arm64
@@ -88,9 +90,6 @@ update-patch:
8890
if [ -z "$(PYTHON_REPO_DIR)" ]; then echo "\n\nPYTHON_REPO_DIR must be set to the root of your Python github checkout\n\n"; fi
8991
cd $(PYTHON_REPO_DIR) && git diff -D v$(PYTHON_VERSION) $(PYTHON_VER) | filterdiff -X $(PROJECT_DIR)/patch/Python/diff-exclude.lst -p 1 --clean > $(PROJECT_DIR)/patch/Python/Python.patch
9092

91-
upload: $(foreach os,$(OS),$(os))
92-
python tools/upload.py b$(BUILD_NUMBER)
93-
9493
###########################################################################
9594
# OpenSSL
9695
# These build instructions adapted from the scripts developed by
@@ -228,16 +227,12 @@ endif
228227

229228
# Build OpenSSL
230229
$$(OPENSSL_DIR-$1)/libssl.a $$(OPENSSL_DIR-$1)/libcrypto.a: $$(OPENSSL_DIR-$1)/Makefile
231-
# Installing multiple times causes problems with the man directory.
232-
# Since we're just overwriting anyway, and we're not going to keep the man files
233-
# delete the man directory (if it exists) first.
234-
rm -rf $(PROJECT_DIR)/build/$2/openssl/man
235-
# Make the build
230+
# Make the build, and install just the software (not the docs)
236231
cd $$(OPENSSL_DIR-$1) && \
237232
CC="$$(CC-$1)" \
238233
CROSS_TOP="$$(dir $$(SDK_ROOT-$1)).." \
239234
CROSS_SDK="$$(notdir $$(SDK_ROOT-$1))" \
240-
make all && make install
235+
make all && make install_sw
241236

242237
# Unpack BZip2
243238
$$(BZIP2_DIR-$1)/Makefile: downloads/bzip2-$(BZIP2_VERSION).tgz
@@ -277,17 +272,22 @@ $$(PYTHON_DIR-$1)/Makefile: downloads/Python-$(PYTHON_VERSION).tgz $$(PYTHON_HOS
277272
tar zxf downloads/Python-$(PYTHON_VERSION).tgz --strip-components 1 -C $$(PYTHON_DIR-$1)
278273
# Apply target Python patches
279274
cd $$(PYTHON_DIR-$1) && patch -p1 < $(PROJECT_DIR)/patch/Python/Python.patch
280-
cp -f $(PROJECT_DIR)/patch/Python/Setup.embedded $$(PYTHON_DIR-$1)/Modules/Setup.embedded
281-
282275
# Configure target Python
283276
ifeq ($2,macOS)
277+
# A locally hosted Python requires a full Setup.local configuration
278+
# because there's no PYTHON_HOST_PLATFORM to cause Setup.local to be
279+
# generated
280+
cat $(PROJECT_DIR)/patch/Python/Setup.embedded $(PROJECT_DIR)/patch/Python/Setup.macOS-x86_64 > $$(PYTHON_DIR-$1)/Modules/Setup.local
284281
# Make a fully embedded macOS build
285-
cat $$(PYTHON_DIR-$1)/Modules/Setup.embedded $(PROJECT_DIR)/patch/Python/Setup.macOS-x86_64 > $$(PYTHON_DIR-$1)/Modules/Setup.local
286282
cd $$(PYTHON_DIR-$1) && MACOSX_DEPLOYMENT_TARGET=$$(MACOSX_DEPLOYMENT_TARGET) ./configure \
287283
--prefix=$(PROJECT_DIR)/$$(PYTHON_DIR-$1)/dist \
288284
--without-doc-strings --enable-ipv6 --without-ensurepip \
289285
$$(PYTHON_CONFIGURE-$2)
290286
else
287+
# Copy in the embedded and platform/arch configuration
288+
cp -f $(PROJECT_DIR)/patch/Python/Setup.embedded $$(PYTHON_DIR-$1)/Modules/Setup.embedded
289+
if [ -e "$(PROJECT_DIR)/patch/Python/Setup.$2-$$(ARCH-$1)" ]; then \
290+
cp -f $(PROJECT_DIR)/patch/Python/Setup.$2-$$(ARCH-$1) $$(PYTHON_DIR-$1)/Modules/Setup.$2-$$(ARCH-$1); fi
291291
cd $$(PYTHON_DIR-$1) && PATH=$(PROJECT_DIR)/$(PYTHON_DIR-macOS)/dist/bin:$(PATH) ./configure \
292292
CC="$$(CC-$1)" LD="$$(CC-$1)" \
293293
--host=$$(MACHINE_DETAILED-$1)-apple-$(shell echo $2 | tr '[:upper:]' '[:lower:]') \
@@ -328,12 +328,12 @@ XZ_FRAMEWORK-$1=build/$1/Support/XZ
328328
PYTHON_FRAMEWORK-$1=build/$1/Support/Python
329329
PYTHON_RESOURCES-$1=$$(PYTHON_FRAMEWORK-$1)/Resources
330330

331-
$1: dist/Python-$(PYTHON_VER)-$1-support.b$(BUILD_NUMBER).tar.gz
331+
$1: dist/Python-$(PYTHON_VER)-$1-support.$(BUILD_NUMBER).tar.gz
332332

333333
clean-$1:
334334
rm -rf build/$1
335335

336-
dist/Python-$(PYTHON_VER)-$1-support.b$(BUILD_NUMBER).tar.gz: $$(BZIP2_FRAMEWORK-$1) $$(XZ_FRAMEWORK-$1) $$(OPENSSL_FRAMEWORK-$1) $$(PYTHON_FRAMEWORK-$1)
336+
dist/Python-$(PYTHON_VER)-$1-support.$(BUILD_NUMBER).tar.gz: $$(BZIP2_FRAMEWORK-$1) $$(XZ_FRAMEWORK-$1) $$(OPENSSL_FRAMEWORK-$1) $$(PYTHON_FRAMEWORK-$1)
337337
mkdir -p dist
338338
echo "Python version: $(PYTHON_VERSION) " > build/$1/Support/VERSIONS
339339
echo "Build: $(BUILD_NUMBER)" >> build/$1/Support/VERSIONS
@@ -344,9 +344,12 @@ dist/Python-$(PYTHON_VER)-$1-support.b$(BUILD_NUMBER).tar.gz: $$(BZIP2_FRAMEWORK
344344
ifeq ($1,macOS)
345345
cp -r build/$1/Python-$(PYTHON_VERSION)-macosx.x86_64/dist build/$1/python
346346
mv build/$1/Support/VERSIONS build/$1/python/VERSIONS
347-
tar zcvf $$@ -C build/$1/python `ls -A build/$1/python`
347+
tar zcvf $$@ -X patch/Python/exclude.macOS -C build/$1/python `ls -A build/$1/python`
348348
else
349-
tar zcvf $$@ -C build/$1/Support `ls -A build/$1/Support`
349+
# Build a "full" tarball with all content for test purposes
350+
tar zcvf dist/Python-$(PYTHON_VER)-$1-support.test-$(BUILD_NUMBER).tar.gz -X patch/Python/test-exclude.embedded -C build/$1/Support `ls -A build/$1/Support`
351+
# Build a distributable tarball
352+
tar zcvf $$@ -X patch/Python/exclude.embedded -C build/$1/Support `ls -A build/$1/Support`
350353
endif
351354

352355
# Build OpenSSL
@@ -411,7 +414,7 @@ build/$1/xz/lib/liblzma.a: $$(foreach target,$$(TARGETS-$1),$$(XZ_DIR-$$(target)
411414

412415
$1: Python-$1
413416

414-
Python-$1: dist/Python-$(PYTHON_VER)-$1-support.b$(BUILD_NUMBER).tar.gz
417+
Python-$1: dist/Python-$(PYTHON_VER)-$1-support.$(BUILD_NUMBER).tar.gz
415418

416419
# Build Python
417420
$$(PYTHON_FRAMEWORK-$1): build/$1/libpython$(PYTHON_VER)m.a $$(foreach target,$$(TARGETS-$1),build/$1/$$(pyconfig.h-$$(target)))
@@ -432,16 +435,7 @@ endif
432435
cp -f -r $$(PYTHON_FRAMEWORK-$1)/Headers/Python.h $$(PYTHON_RESOURCES-$1)/include/python$(PYTHON_VER)m
433436

434437
# Copy the standard library from the simulator build
435-
ifneq ($(TEST),)
436438
cp -f -r $$(PYTHON_DIR-$$(firstword $$(TARGETS-$1)))/dist/lib $$(PYTHON_RESOURCES-$1)
437-
# Remove the pieces of the resources directory that aren't needed:
438-
rm -f $$(PYTHON_RESOURCES-$1)/lib/libpython$(PYTHON_VER)m.a
439-
rm -rf $$(PYTHON_RESOURCES-$1)/lib/pkgconfig
440-
else
441-
mkdir -p $$(PYTHON_RESOURCES-$1)/lib
442-
cd $$(PYTHON_DIR-$$(firstword $$(TARGETS-$1)))/dist/lib/python$(PYTHON_VER) && \
443-
zip -x@$(PROJECT_DIR)/patch/Python/lib-exclude.lst -r $(PROJECT_DIR)/$$(PYTHON_RESOURCES-$1)/lib/python$(subst .,,$(PYTHON_VER)) *
444-
endif
445439

446440
# Copy fat library
447441
cp -f $$(filter %.a,$$^) $$(PYTHON_FRAMEWORK-$1)/libPython.a

patch/Python/exclude.embedded

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This is a list of Python standard library path patterns
2+
# we exclude from the embedded device Python-Apple-support tarballs.
3+
# It is used by `tar -X` during the Makefile build.
4+
#
5+
# Remove binaries; not needed for
6+
Python/Resources/bin
7+
# Remove includes; use the version packaged in Headers
8+
Python/Resources/include
9+
# Remove the Resources version of libpython;
10+
# we use the version packaged at the root level
11+
Python/Resources/lib/libpython3.*.a
12+
# Remove lib/pkgconfig files. These are used for compiling C extension modules.
13+
Python/Resources/lib/pkgconfig
14+
# Remove standard library test suites.
15+
Python/Resources/lib/python*/ctypes/test
16+
Python/Resources/lib/python*/distutils/tests
17+
Python/Resources/lib/python*/lib2to3/tests
18+
Python/Resources/lib/python*/sqlite3/test
19+
Python/Resources/lib/python*/test
20+
# Remove compiled test and example modules.
21+
Python/Resources/lib/python*/lib-dynload/_test*.so
22+
Python/Resources/lib/python*/lib-dynload/_ctypes_test*.so
23+
Python/Resources/lib/python*/lib-dynload/xxlimited*.so
24+
Python/Resources/lib/python*/lib-dynload/_xxtestfuzz.so
25+
# Remove wsgiref web app module; it's unusual that mobile apps would
26+
# start a web app server with it.
27+
Python/Resources/lib/python*/wsgiref
28+
# Remove command-line curses toolkit.
29+
Python/Resources/lib/python*/curses
30+
# Remove config-* directory, which is used for compiling C extension modules.
31+
Python/Resources/lib/python*/config-*
32+
# Remove ensurepip. If user code needs pip, it can add it to
33+
Python/Resources/lib/python*/ensurepip
34+
# Remove Tcl/Tk GUI code. We don't build against Tcl/Tk at the moment, so this
35+
# will not work.
36+
Python/Resources/lib/python*/idlelib
37+
Python/Resources/lib/python*/tkinter
38+
Python/Resources/lib/python*/turtle.py
39+
Python/Resources/lib/python*/turtledemo
40+
# Remove site-packages directory. The template unpacks user code and
41+
# dependencies to a different path.
42+
Python/Resources/lib/python*/site-packages
43+
# Remove share/ directory, which contains user documentation (man pages).
44+
Python/Resources/share
45+
# Remove pyc files. These take up space, but since most stdlib modules are
46+
# never imported by user code, they mostly have no value.
47+
Python/Resources/*/*.pyc

0 commit comments

Comments
 (0)