Diff xpra-4.4.6-r2 with a xpra-9999

/usr/portage/x11-wm/xpra/xpra-9999.ebuild 2024-12-25 14:59:53.515270201 +0300
3 3

  
4 4
EAPI=8
5 5

  
6
if [[ ${PV} = 9999* ]]; then
6
if [[ ${PV} = *9999* ]]; then
7 7
	EGIT_REPO_URI="https://github.com/Xpra-org/xpra.git"
8
	if [[ ${PV} = 6.9999* ]]; then
9
		EGIT_BRANCH="v6.x"
10
	fi
8 11
	inherit git-r3
9 12
else
10 13
	inherit pypi
11
	KEYWORDS="amd64 x86"
14
	KEYWORDS="~amd64 ~x86"
12 15
fi
13 16

  
14
PYTHON_COMPAT=( python3_{10..11} )
17
PYTHON_COMPAT=( python3_{10..12} )
15 18
DISTUTILS_USE_PEP517=setuptools
16 19
DISTUTILS_SINGLE_IMPL=yes
17 20
DISTUTILS_EXT=1
18 21

  
19
inherit xdg distutils-r1 prefix tmpfiles udev
22
inherit cuda xdg distutils-r1 prefix tmpfiles udev
20 23

  
21 24
DESCRIPTION="X Persistent Remote Apps (xpra) and Partitioning WM (parti) based on wimpiggy"
22 25
HOMEPAGE="https://xpra.org/"
23 26
LICENSE="GPL-2 BSD"
24 27
SLOT="0"
25
IUSE="brotli +client +clipboard crypt csc cups dbus doc ffmpeg jpeg html ibus +lz4 lzo minimal oauth opengl pinentry pulseaudio +server sound systemd test +trayicon udev vpx webcam webp xdg xinerama"
26
IUSE+=" +python_single_target_python3_11"
28
IUSE="+X avif brotli +client +clipboard crypt csc cuda cups dbus debug doc examples gstreamer +gtk3 html ibus jpeg +lz4 lzo mdns minimal oauth opengl openh264 pinentry pulseaudio qrcode +server sound systemd test +trayicon udev vpx webcam webp x264 xdg xinerama "
29
IUSE+=" video_cards_nvidia"
30
RESTRICT="!test? ( test )"
27 31

  
28 32
REQUIRED_USE="${PYTHON_REQUIRED_USE}
29
	|| ( client server )
33
	|| ( client gtk3 server )
30 34
	cups? ( dbus )
31 35
	oauth? ( server )
32 36
	opengl? ( client )
33
	test? ( client clipboard crypt dbus html server sound xdg xinerama )
37
	clipboard? ( gtk3 )
38
	gtk3? ( client )
39
	test? ( client clipboard crypt dbus gstreamer html server sound xdg xinerama )
34 40
"
35 41

  
36 42
TEST_DEPEND="
......
45 51
	server? (
46 52
		x11-base/xorg-server[-minimal,xvfb]
47 53
		x11-drivers/xf86-input-void
54
		x11-drivers/xf86-video-dummy
48 55
	)
56
	webcam? ( media-video/v4l2loopback )
49 57
	xinerama? ( x11-libs/libfakeXinerama )
50 58
"
51 59
DEPEND="
52 60
	${PYTHON_DEPS}
53 61
	$(python_gen_cond_dep '
54
		dev-python/pygobject:3[${PYTHON_USEDEP},cairo]
62
		dev-python/pygobject:3[${PYTHON_USEDEP}]
55 63
		opengl? ( dev-python/pyopengl[${PYTHON_USEDEP}] )
56 64
		sound? ( dev-python/gst-python:1.0[${PYTHON_USEDEP}] )
65
		gtk3? (
66
			dev-python/pygobject:3[cairo]
67
		)
57 68
	')
58
	x11-libs/gtk+:3[introspection]
59
	x11-libs/libX11
60
	x11-libs/libXcomposite
61
	x11-libs/libXdamage
62
	x11-libs/libXfixes
63
	x11-libs/libXrandr
64
	x11-libs/libXres
65
	x11-libs/libXtst
66
	x11-libs/libxkbfile
69
	dev-libs/xxhash
70
	avif? ( media-libs/libavif )
67 71
	brotli? ( app-arch/brotli )
68
	csc? ( >=media-video/ffmpeg-1.2.2:0= )
69
	ffmpeg? ( >=media-video/ffmpeg-3.2.2:0=[x264] )
72
	client? (
73
			x11-libs/gtk+:3[X?,introspection]
74
		)
70 75
	jpeg? ( media-libs/libjpeg-turbo )
76
	mdns? ( dev-libs/mdns )
77
	openh264? ( media-libs/openh264:= )
71 78
	pulseaudio? (
72
		media-libs/libpulse
73 79
		media-plugins/gst-plugins-pulse:1.0
80
		media-plugins/gst-plugins-opus
74 81
	)
82
	qrcode? ( media-gfx/qrencode )
75 83
	sound? (
76 84
		media-libs/gstreamer:1.0
77 85
		media-libs/gst-plugins-base:1.0
78 86
	)
79
	vpx? ( media-libs/libvpx media-video/ffmpeg )
87
	vpx? ( media-libs/libvpx )
80 88
	webp? ( media-libs/libwebp )
89
	X? (
90
		x11-apps/xrandr
91
		x11-libs/libXcomposite
92
		x11-libs/libXdamage
93
		x11-libs/libXfixes
94
		x11-libs/libXrandr
95
		x11-libs/libXres
96
		x11-libs/libXtst
97
		x11-libs/libxkbfile
98
	)
99
	x264? ( media-libs/x264 )
81 100
"
101
# nvenc? ( amd64? ( media-libs/nv-codec-headers ) )
82 102
RDEPEND="
83 103
	${DEPEND}
84 104
	${TEST_DEPEND}
......
105 125
	udev? ( virtual/udev )
106 126
"
107 127
DEPEND+="
108
	test? ( ${TEST_DEPEND} )
128
	test? (
129
		${TEST_DEPEND}
130
		$(python_gen_cond_dep '
131
			dev-python/paramiko[${PYTHON_USEDEP}]
132
		')
133
	)
109 134
"
110 135
BDEPEND="
111 136
	$(python_gen_cond_dep '
112
		>=dev-python/cython-0.16[${PYTHON_USEDEP}]
137
		dev-python/cython[${PYTHON_USEDEP}]
138
		dev-python/pip[${PYTHON_USEDEP}]
113 139
	')
114 140
	virtual/pkgconfig
115 141
	doc? ( virtual/pandoc )
116 142
"
117 143

  
118
# Broken by PEP517 migration, and some tests failed for a while before that for
119
# unknown reasons.
120
RESTRICT="test"
121

  
122 144
PATCHES=(
123
	"${FILESDIR}"/${PN}-4.4-xdummy.patch
145
	"${FILESDIR}/${PN}-9999-pep517.patch"
124 146
)
125 147

  
126
python_prepare_all() {
127
	if use minimal; then
128
		sed -r -e '/pam_ENABLED/s/DEFAULT/False/' \
129
			-e 's/^(xdg_open)_ENABLED = .*/\1_ENABLED = False/' \
130
			-i setup.py || die
131
		PATCHES+=( "${FILESDIR}"/${PN}-4.4.6_minimal-features.patch )
132
	fi
148
src_prepare() {
149
	default
133 150

  
151
	sed \
152
		-e 's#UNITTESTS_DIR=`dirname $(readlink -f $0)`#: "${UNITTESTS_DIR:=`dirname $(readlink -f $0)`}"#' \
153
		-e 's#INSTALL_ROOT="$SRC_DIR/dist/python${PYTHON_VERSION}"#: "${INSTALL_ROOT:=$SRC_DIR/dist/python${PYTHON_VERSION}}"#' \
154
		-e '/setup.py install/d' \
155
		-i "${S}/tests/unittests/run" || die
156
}
157

  
158
python_prepare_all() {
134 159
	distutils-r1_python_prepare_all
135 160

  
136 161
	hprefixify xpra/scripts/config.py
137 162

  
138 163
	sed -r -e "/\bdoc_dir =/s:/${PN}/\":/${PF}/html\":" \
139 164
		-i setup.py || die
165

  
166
	if use minimal; then
167
		sed -r -e '/pam_ENABLED/s/DEFAULT/False/' \
168
			-e 's/^(xdg_open)_ENABLED = .*/\1_ENABLED = False/' \
169
			-i setup.py || die
170
	fi
140 171
}
141 172

  
142 173
python_configure_all() {
......
144 175
		-i setup.py || die
145 176

  
146 177
	DISTUTILS_ARGS=(
147
		--without-PIC
148
		--without-Xdummy
149
		$(use_with client)
150
		$(use_with clipboard)
151
		$(use_with csc csc_swscale)
178
		--with-PIC
179
		"$(use_with avif)"
180
		"$(use_with brotli)"
181
		"$(use_with sound audio)"
182
		"$(use_with client)"
183
		"$(use_with clipboard)"
184
		"$(use_with csc csc_cython)"
152 185
		--without-csc_libyuv
153
		--without-cuda_rebuild
154
		--without-cuda_kernels
155
		$(use_with cups printing)
156
		--without-debug
157
		$(use_with dbus)
158
		$(use_with doc docs)
159
		$(use_with ffmpeg dec_avcodec2)
160
		$(use_with ffmpeg enc_ffmpeg)
161
		$(use_with ffmpeg enc_x264)
162
		--without-enc_x265
163
		--with-gtk3
164
		$(use_with jpeg jpeg_encoder)
165
		$(use_with jpeg jpeg_decoder)
166
		--without-mdns
167
		--without-sd_listen
168
		--without-service
169
		$(use_with opengl)
170
		$(use_with server shadow)
171
		$(use_with server)
172
		$(use_with sound)
173
		--without-strict
174
		$(use_with vpx)
175
		--with-warn
176
		$(use_with webcam)
177
		$(use_with webp)
178
		--with-x11
186
		# "$(use_with csc csc_libyuv)" # https://chromium.googlesource.com/libyuv/libyuv
187
		"$(use_with cuda cuda_rebuild)"
188
		"$(use_with cuda cuda_kernels)"
189
		"$(use_with dbus)"
190
		"$(use_with debug)"
191
		"$(use_with doc docs)"
192
		--without-evdi
193
		# "$(use_with evdi)" x11-drivers/evdi::guru
194
		"$(use_with examples example)"
195
		"$(use_with gstreamer)"
196
		"$(use_with gstreamer gstreamer_audio)"
197
		"$(use_with gstreamer gstreamer_video)"
198
		"$(use_with gtk3)"
199
		"$(use_with html http)"
200
		"$(use_with mdns)"
201
		"$(use_with video_cards_nvidia nvidia)"
202
		--without-nvdec
203
		--without-nvenc
204
		--without-nvfbc
205
		# "$(use_with nvenc nvdec)" # NVIDIA Video Codec SDK
206
		# "$(use_with nvenc nvenc)" # NVIDIA Video Codec SDK
207
		# "$(use_with nvenc nvfbc)" # NVIDIA Capture SDK
208
		"$(use_with opengl)"
209
		"$(use_with openh264)"
210
		"$(use_with cups printing)"
211
		--without-pandoc_lua
212
		"$(use_with qrcode qrencode)"
213
		--without-quic
214
		# "$(use_with quic)" # https://github.com/aiortc/aioquic
215
		"$(use_with systemd sd_listen)"
216
		"$(use_with server)"
217
		"$(use_with systemd service)"
218
		"$(use_with server shadow)"
219
		"$(use_with vpx)"
220
		"$(use_with webcam)"
221
		"$(use_with webp)"
222
		"$(use_with X x11)"
223
		"$(use_with X Xdummy)"
224

  
225
		"$(use_with test tests)"
226
		--with-strict
227
		# --with-verbose
228
		# --with-warn
229
		# --with-cythonize_more
230

  
231
		--pkg-config-path="${S}/fs/lib/pkgconfig"
179 232
	)
180 233

  
181
	export XPRA_SOCKET_DIRS="${EPREFIX}/run/xpra"
234
	if use server; then
235
		DISTUTILS_ARGS+=(
236
			"$(use_with jpeg jpeg_encoder)"
237
			"$(use_with vpx vpx_encoder)"
238
			"$(use_with openh264 openh264_encoder)"
239
			"$(use_with cuda nvjpeg_encoder)"
240
			"$(use_with avif avif_encoder)"
241
			"$(use_with webp webp_encoder)"
242
			--without-spng_encoder
243
			# "$(use_with spng spng_encoder)" # https://github.com/randy408/libspng
244
		)
245
	else
246
		DISTUTILS_ARGS+=(
247
			--without-jpeg_encoder
248
			--without-vpx_encoder
249
			--without-openh264_encoder
250
			--without-nvjpeg_encoder
251
			--without-avif_encoder
252
			--without-webp_encoder
253
			--without-spng_encoder
254
		)
255
	fi
256

  
257
	if use client || use gtk3; then
258
		DISTUTILS_ARGS+=(
259
			"$(use_with vpx vpx_decoder)"
260
			"$(use_with openh264 openh264_decoder)"
261
			"$(use_with cuda nvjpeg_decoder)"
262
			"$(use_with jpeg jpeg_decoder)"
263
			"$(use_with avif avif_decoder)"
264
			"$(use_with webp webp_decoder)"
265
			--without-spng_decoder
266
			# "$(use_with spng spng_decoder)" # https://github.com/randy408/libspng
267
		)
268
	else
269
		DISTUTILS_ARGS+=(
270
			--without-jpeg_decoder
271
			--without-vpx_decoder
272
			--without-openh264_decoder
273
			--without-nvjpeg_decoder
274
			--without-avif_decoder
275
			--without-webp_decoder
276
			--without-spng_decoder
277
		)
278
	fi
279

  
280
	DISTUTILS_ARGS+=(
281
		# Arguments from user
282
		"${MYDISTUTILS_ARGS[@]}"
283
	)
284

  
285
	export XPRA_SOCKET_DIRS="${EPREFIX}/var/run/xpra"
286
}
287

  
288
python_compile() {
289
	if use cuda; then
290
		export NVCC_PREPEND_FLAGS="-ccbin $(cuda_gccdir)/g++"
291
	fi
292

  
293
	PYTHONPATH="${S}" distutils-r1_python_compile
182 294
}
183 295

  
184 296
python_test() {
185
	export XAUTHORITY=${HOME}/.Xauthority
186
	touch "${XAUTHORITY}" || die
297
	einfo "${BUILD_DIR}/install/$(python_get_sitedir)"
298

  
299
	use cuda && cuda_add_sandbox -w
300
	addwrite /dev/dri/renderD128
301

  
302
	addpredict /dev/dri/card0
303
	addpredict /dev/fuse
304
	addpredict /dev/tty0
305
	addpredict /dev/vga_arbiter
306
	addpredict /proc/mtrr
307
	addpredict /var/run/utmp
308

  
309
	addpredict "$(python_get_sitedir)"
310

  
311
	if [[ -d "/sys/devices/virtual/video4linux" ]]; then
312
		local devices
313
		readarray -t devices <<<"$(find /sys/devices/virtual/video4linux -mindepth 1 -maxdepth 1 -type d -name 'video*' )"
314
		for device in "${devices[@]}"; do
315
			addwrite "/dev/$(basename "${device}" || die )"
316
		done
317
	fi
187 318

  
188
	distutils_install_for_testing
189 319
	xdg_environment_reset
190 320

  
191
	env -u WAYLAND_DISPLAY -u XDG_SESSION_TYPE \
192
	PYTHONPATH="${S}/tests/unittests:${BUILD_DIR}/test/lib" \
193
	XPRA_SYSTEMD_RUN=$(usex systemd) XPRA_TEST_COVERAGE=0 \
194
		"${PYTHON}" "${S}"/tests/unittests/unit/run.py || die
321
	export XAUTHORITY=${T}/.Xauthority
322
	touch "${XAUTHORITY}" || die
323

  
324
	local -x XPRA_TEST_COVERAGE=0 INSTALL_ROOT="${BUILD_DIR}/install" UNITTESTS_DIR="${S}/tests/unittests"
325

  
326
	tests/unittests/run \
327
		--skip-fail unit.client.mixins.audioclient_test \
328
		--skip-fail unit.client.x11_client_test \
329
		--skip-fail unit.net.net_util_test \
330
		--skip-fail unit.notifications.common_test \
331
		--skip-fail unit.server.mixins.shadow_option_test \
332
		--skip-fail unit.server.mixins.start_option_test \
333
		--skip-fail unit.server.mixins.startdesktop_option_test \
334
		--skip-fail unit.server.server_auth_test \
335
		--skip-fail unit.server.shadow_server_test \
336
		--skip-fail unit.x11.x11_server_test \
337
		--skip-slow unit.client.mixins.webcam_test \
338
		--skip-slow unit.server.server_sockets_test \
339
		--skip-slow unit.server.source.source_mixins_test \
340
	|| die -n
195 341
}
196 342

  
197
python_install_all() {
198
	distutils-r1_python_prepare_all
343
python_install() {
344
	# remove test file
345
	rm -vrf "${BUILD_DIR}/install/usr/share/xpra/www"
346

  
347
	distutils-r1_python_install
348
}
199 349

  
200
	# Switching to PEP517 gives /usr/etc. Previously, setup.py hardcodes
201
	# if root_prefix.endswith("/usr"):
202
	#     root_prefix = root_prefix[:-4]
203
	# But now setuptools uses data/* to represent out-of-sitedir files.
204
	# The upstream hack no longer works. We are on our own.
350
python_install_all() {
351
	distutils-r1_python_install_all
205 352

  
206 353
	mv -v "${ED}"/usr/etc "${ED}"/ || die
207 354

  
355
	sed -e "s#/.*data/etc#/etc#g" \
356
		-i "${ED}/etc/xpra/conf.d/"* || die
357

  
208 358
	# Move udev dir to the right place if necessary.
209 359
	if use udev; then
210
		local dir=$(get_udevdir)
360
		local dir
361
		dir=$(get_udevdir)
211 362
		if [[ ! ${ED}/usr/lib/udev -ef ${ED}${dir} ]]; then
212 363
			dodir "${dir%/*}"
213 364
			mv -vnT "${ED}"/usr/lib/udev "${ED}${dir}" || die
Thank you!