Skip to content

Commit 6e0d4a1

Browse files
committed
Rework exclusion files so that they're correctly applied to macOS.
1 parent dd18003 commit 6e0d4a1

File tree

5 files changed

+127
-25
lines changed

5 files changed

+127
-25
lines changed

Makefile

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,12 @@ dist/Python-$(PYTHON_VER)-$1-support.b$(BUILD_NUMBER).tar.gz: $$(BZIP2_FRAMEWORK
343343
ifeq ($1,macOS)
344344
cp -r build/$1/Python-$(PYTHON_VERSION)-macosx.x86_64/dist build/$1/python
345345
mv build/$1/Support/VERSIONS build/$1/python/VERSIONS
346-
tar zcvf $$@ -C build/$1/python `ls -A build/$1/python`
346+
tar zcvf $$@ -X patch/Python/exclude.macOS -C build/$1/python `ls -A build/$1/python`
347347
else
348-
tar zcvf $$@ -C build/$1/Support `ls -A build/$1/Support`
348+
# Build a "full" tarball with all content for test purposes
349+
tar zcvf dist/Python-$(PYTHON_VER)-$1-support.test-b$(BUILD_NUMBER).tar.gz -X patch/Python/test-exclude.embedded -C build/$1/Support `ls -A build/$1/Support`
350+
# Build a distributable tarball
351+
tar zcvf $$@ -X patch/Python/exclude.embedded -C build/$1/Support `ls -A build/$1/Support`
349352
endif
350353

351354
# Build OpenSSL
@@ -431,16 +434,7 @@ endif
431434
cp -f -r $$(PYTHON_FRAMEWORK-$1)/Headers/Python.h $$(PYTHON_RESOURCES-$1)/include/python$(PYTHON_VER)
432435

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

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

patch/Python/exclude.embedded

Lines changed: 47 additions & 0 deletions
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

patch/Python/exclude.macOS

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This is a list of Python standard library path patterns
2+
# we exclude from the macOS Python-Apple-support tarball.
3+
# It is used by `tar -X` during the Makefile build.
4+
#
5+
# Remove binaries that aren't needed to support apps
6+
bin/2to3*
7+
bin/idle3*
8+
bin/pydoc3*
9+
bin/python3*-config
10+
bin/pyvenv*
11+
bin/python3.*
12+
# Remove include/ directory, only useful for compiling C extension modules.
13+
include
14+
# Remove libpython.a. We're using a static binary; we don't need a library.
15+
lib/libpython3.*.a
16+
# Remove lib/pkgconfig files. These are used for compiling C extension modules.
17+
lib/pkgconfig
18+
# Remove standard library test suites.
19+
lib/python*/ctypes/test
20+
lib/python*/distutils/tests
21+
lib/python*/lib2to3/tests
22+
lib/python*/sqlite3/test
23+
lib/python*/test
24+
# Remove compiled test and example modules.
25+
lib/python*/lib-dynload/_test*.so
26+
lib/python*/lib-dynload/_ctypes_test*.so
27+
lib/python*/lib-dynload/xxlimited*.so
28+
lib/python*/lib-dynload/_xxtestfuzz*.so
29+
lib/python*/lib-dynload/_curses*.so
30+
# Remove command-line curses toolkit.
31+
lib/python*/curses
32+
# Remove config-* directory, which is used for compiling C extension modules.
33+
lib/python*/config-*
34+
# Remove ensurepip. If user code needs pip, it can add it to
35+
lib/python*/ensurepip
36+
# Remove Tcl/Tk GUI code. We don't build against Tcl/Tk at the moment, so this
37+
# will not work.
38+
lib/python*/idlelib
39+
lib/python*/tkinter
40+
lib/python*/turtle.py
41+
lib/python*/turtledemo
42+
# Remove site-packages directory. The template unpacks user code and
43+
# dependencies to a different path.
44+
lib/python*/site-packages
45+
# Remove share/ directory, which contains user documentation (man pages).
46+
share
47+
# Remove pyc files. These take up space, but since most stdlib modules are
48+
# never imported by user code, they mostly have no value.
49+
*/*.pyc

patch/Python/lib-exclude.lst

Lines changed: 0 additions & 14 deletions
This file was deleted.

patch/Python/test-exclude.embedded

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# This is a list of Python standard library path patterns
2+
# we exclude from the embedded device Python-Apple-support test tarballs.
3+
# It is used by `tar -X` during the Makefile build.
4+
#
5+
# Remove binaries
6+
Python/Resources/bin
7+
# Remove include/ directory, only useful for compiling C extension modules.
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 compiled test and example modules.
15+
Python/Resources/lib/python*/lib-dynload/_test*.so
16+
Python/Resources/lib/python*/lib-dynload/_ctypes_test*.so
17+
Python/Resources/lib/python*/lib-dynload/xxlimited*.so
18+
Python/Resources/lib/python*/lib-dynload/_xxtestfuzz.so
19+
# Remove site-packages directory. The template unpacks user code and
20+
# dependencies to a different path.
21+
Python/Resources/lib/python*/site-packages
22+
# Remove share/ directory, which contains user documentation (man pages).
23+
Python/Resources/share
24+
# Remove pyc files. These take up space, but since most stdlib modules are
25+
# never imported by user code, they mostly have no value.
26+
Python/Resources/*/*.pyc

0 commit comments

Comments
 (0)