summaryrefslogtreecommitdiffstats
path: root/python39.cygport
blob: bd5bcaf9012e70f07c8b4393ddc11f2a78917f52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
NAME="python39"
VERSION=3.9.9
RELEASE=1
CATEGORY="Python Interpreters"
SUMMARY="Py3K language interpreter"
DESCRIPTION="Python is an interpreted, interactive, object-oriented programming
language. It incorporates modules, exceptions, dynamic typing, very high level
dynamic data types, and classes. Python combines remarkable power with very
clear syntax. It has interfaces to many system calls and libraries, as well as
to various window systems, and is extensible in C or C++. It is also usable as
an extension language for applications that need a programmable interface."
HOMEPAGE="https://www.python.org/"
SRC_URI="https://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tar.xz"
SRC_DIR="Python-${VERSION}"

PATCH_URI="
00001-rpath.patch
00111-no-static-lib.patch
00189-use-rpm-wheels.patch
00251-change-user-install-location.patch
00328-pyc-timestamp-invalidation-mode.patch
00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch
3.1-enable-new-dtags.patch
3.4-select-cygwin.patch
3.4-shebang.patch
3.6.12-socketmodule.patch
3.7-ctypes-cygwin.patch
3.7-ftm.patch
3.8-dbm-cygwin.patch
3.8-distutils-cygwin.patch
3.8-export-PySignal_SetWakeupFd.patch
3.8-nis-cygwin.patch
3.8-parser-cygwin.patch
3.8-tkinter-cygwin.patch
3.8-xxsubinterpreters-cygwin.patch
3.8_socketpair.patch
tcp-socketmodule.patch
3.8.7-pep3149-cygwin.patch
3.8.10-no-mscvrt.patch
3.8.10-ossaudiodev.patch
3.8.10-libcrypt2.patch
3.8.10-casesensitive.patch
"
#3.2-getpath-exe-extension.patch

slot=${PV:0:3}
pyrootdir=/usr/lib/python${slot}
pyconfdir=${pyrootdir}/config-${slot}-${ARCH/i6/i3}-cygwin
pydylddir=${pyrootdir}/lib-dynload

PKG_NAMES="python${slot/.} python${slot/.}-devel python${slot/.}-test python${slot/.}-tkinter idle${slot/.}"
python39_REQUIRES="binutils libcrypt2" # ctypes.util.find_library
python39_REQUIRES+=" python39-pip python39-setuptools" # ensurepip
python39_CONTENTS="
	--exclude=idle3* --exclude=idlelib
	--exclude=_tkinter*.dll --exclude=tkinter --exclude=turtle*
	--exclude=${pyrootdir#/}/*/test
	--exclude=${pyrootdir#/}/*/tests
	--exclude=*_test*.dll
	etc/postinstall/python39.sh
	etc/preremove/python39.sh
	usr/bin/libpython${slot}.dll
	usr/bin/pydoc${slot}
	usr/bin/python${slot}.exe
	usr/include/python${slot}/pyconfig.h
	${pydylddir#/}/
	${pyrootdir#/}/asyncio/
	${pyrootdir#/}/collections/
	${pyrootdir#/}/concurrent/
	${pyconfdir#/}/Makefile
	${pyrootdir#/}/ctypes/
	${pyrootdir#/}/curses/
	${pyrootdir#/}/dbm/
	${pyrootdir#/}/distutils/
	${pyrootdir#/}/email/
	${pyrootdir#/}/encodings/
	${pyrootdir#/}/ensurepip/
	${pyrootdir#/}/html/
	${pyrootdir#/}/http/
	${pyrootdir#/}/importlib/
	${pyrootdir#/}/json/
	${pyrootdir#/}/lib2to3/
	${pyrootdir#/}/logging/
	${pyrootdir#/}/multiprocessing/
	${pyrootdir#/}/pydoc_data/
	${pyrootdir#/}/site-packages/
	${pyrootdir#/}/sqlite3/
	${pyrootdir#/}/test/__init__.py
	${pyrootdir#/}/test/__pycache__/__init__.*
	${pyrootdir#/}/test/support/
	${pyrootdir#/}/unittest/
	${pyrootdir#/}/urllib/
	${pyrootdir#/}/venv/
	${pyrootdir#/}/wsgiref/
	${pyrootdir#/}/xml/
	${pyrootdir#/}/xmlrpc/
	${pyrootdir#/}/zoneinfo/
	${pyrootdir#/}/*.py
	${pyrootdir#/}/__pycache__/
	usr/share/doc/${NAME}
	usr/share/man/man1/python${slot}.1*
	var/lib/rebase/dynpath.d/${NAME}
"
python39_devel_REQUIRES="python${slot/.}-setuptools libcrypt-devel"
python39_devel_CONTENTS="
	--exclude=usr/include/python${slot}/pyconfig.h
	--exclude=${pyconfdir#/}/Makefile
	etc/postinstall/python39-devel.sh
	etc/preremove/python39-devel.sh
	usr/bin/2to3-${slot}
	usr/bin/python${slot}-config
	usr/include/python${slot}/
	${pyconfdir#/}/
	usr/lib/libpython${slot}.dll.a
	usr/lib/pkgconfig/python-${slot}.pc
	usr/lib/pkgconfig/python-${slot}-embed.pc
"
idle39_SUMMARY="Python ${slot} Tkinter-based IDE"
idle39_REQUIRES="${NAME}-tkinter"
idle39_CONTENTS="
	--exclude=idle_test
	etc/postinstall/idle39.sh
	etc/preremove/idle39.sh
	usr/bin/idle${slot}
	${pyrootdir#/}/idlelib/
	${pyrootdir#/}/turtledemo/
	usr/share/applications/idle${slot}.desktop
	usr/share/icons/hicolor/*/apps/idle${slot//.}.png
"
python39_test_SUMMARY="Py3K tests"
python39_test_CONTENTS="
	--exclude=${pyrootdir#/}/test/__init__.py
	--exclude=${pyrootdir#/}/test/__pycache__/__init__.*
	--exclude=${pyrootdir#/}/test/support
	${pydylddir#/}/*_test*.dll
	${pyrootdir#/}/ctypes/test/
	${pyrootdir#/}/distutils/tests/
	${pyrootdir#/}/idlelib/idle_test/
	${pyrootdir#/}/lib2to3/tests/
	${pyrootdir#/}/sqlite3/test/
	${pyrootdir#/}/test/
	${pyrootdir#/}/tkinter/test/
	${pyrootdir#/}/unittest/test/
"
python39_tkinter_SUMMARY="Py3K Tkinter GUI module"
python39_tkinter_REQUIRES="tcl-tix"
python39_tkinter_CONTENTS="
	--exclude=test ${pydylddir#/}/_tkinter*
	${pyrootdir#/}/tkinter/
	${pyrootdir#/}/turtle.py
	${pyrootdir#/}/__pycache__/turtle.*
"
PKG_IGNORE="usr/share/man/man1/python3.1*"

REQUIRES_EXCLUDE_FROM="*/distutils/command/*:*/lib2to3/tests/data/*:*/test/*"

DIFF_EXCLUDES=" *.pickle data pyconfig.h.in"
DISTCLEANFILES="Lib/ensurepip/_bundled/*.whl"

NO_AUTOHEADER=1

CFLAGS="${CFLAGS} -DOPENSSL_NO_SSL3=1 -I/usr/include/uuid/"
CYGCONF_ARGS="
	--enable-shared
	--enable-ipv6
	--with-libc=
	--with-libm=
	--with-system-expat
	--with-system-ffi
	--without-ensurepip
	ac_cv_func_bind_textdomain_codeset=yes
"

src_install() {
	cd ${B}
	dodir /usr
	cygmake -j1 DESTDIR=${D} altinstall maninstall

	rm -f ${D}${pyrootdir}/LICENSE.txt

#	dosym ${pyconfdir#/usr/lib/}/libpython${slot}.dll.a /usr/lib/libpython${slot}.dll.a
	cp ${B}/libpython${slot}.dll.a ${D}/usr/lib/libpython${slot}.dll.a

	sed -i -e '1 s/\.exe//' ${D}/usr/bin/*${slot}

	for i in 16 32 48
	do
		insinto /usr/share/icons/hicolor/${i}x${i}/apps
		newins ${S}/Lib/idlelib/Icons/idle_${i}.png idle${slot//.}.png
	done
	make_desktop_entry idle${slot} "IDLE ${slot}" idle${slot//.} "Development;IDE"

	dodir /var/lib/rebase/dynpath.d
	echo ${pyrootdir}/site-packages > ${D}/var/lib/rebase/dynpath.d/${NAME}

	# writing post install alternatives script for python
	mkdir -p ${D}/etc/postinstall
	pushd ${D}/etc/postinstall
	echo "# Install this package as a python alternative.
# PYTHON_VERSION=${slot}
# PYTHON_PRIORITY=${slot/.}
/usr/sbin/alternatives --install /usr/bin/python python /usr/bin/python${slot} ${slot/.}
/usr/sbin/alternatives --install /usr/bin/python3 python3 /usr/bin/python${slot} ${slot/.}
/usr/sbin/alternatives --install /usr/bin/pydoc3 pydoc3 /usr/bin/pydoc${slot} ${slot/.}
" > python${slot/.}.sh

	echo "# Install this package as a python devel alternative.
# PYTHON_VERSION=${slot}
# PYTHON_PRIORITY=${slot/.}
/usr/sbin/alternatives --install /usr/bin/2to3 2to3 /usr/bin/2to3-${slot} ${slot/.}
/usr/sbin/alternatives --install /usr/bin/python3-config python3-config /usr/bin/python${slot}-config ${slot/.}
" > python${slot/.}-devel.sh

	echo "# Install this package as a idle alternative.
# PYTHON_VERSION=${slot}
# PYTHON_PRIORITY=${slot/.}
/usr/sbin/alternatives --install /usr/bin/idle3 idle3 /usr/bin/idle${slot} ${slot/.}
" > idle${slot/.}.sh

	# writing pre remove alternatives script for python
	mkdir -p ${D}/etc/preremove
	pushd ${D}/etc/preremove
	echo "# Remove this package as a python alternative.
/usr/sbin/alternatives --remove python /usr/bin/python${slot}
/usr/sbin/alternatives --remove python3 /usr/bin/python${slot}
/usr/sbin/alternatives --remove pydoc3 /usr/bin/pydoc${slot}
" > python${slot/.}.sh

	echo "# Remove this package as a python alternative.
/usr/sbin/alternatives --remove 2to3 /usr/bin/2to3-${slot}
/usr/sbin/alternatives --remove python3-config /usr/bin/python${slot}-config
" > python${slot/.}-devel.sh

	echo "# Remove this package as a python alternative.
/usr/sbin/alternatives --remove idle3 /usr/bin/idle${slot}
" > idle${slot/.}.sh

}

src_check(){
	cd ${B}
	LD_LIBRARY_PATH=${B}  ${B}/python.exe -m test.regrtest \
		--slowest -j0 \
		--timeout=900 \
		-x test_distutils \
		-x test_gdb

}