diff --git a/debian/changelog b/debian/changelog index a7c3b50..53af8d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,5 @@ -python-xlib (0.8-1) unstable; urgency=low +python-xlib (0.33-ok1) nile; urgency=medium - * Initial Release. (Closes: #105388) + * Build for openKylin. - -- Moshe Zadka Sun, 15 Jul 2001 13:12:01 +0300 - -Local variables: -mode: debian-changelog -End: + -- Luoyaoming Tue, 30 Apr 2024 18:12:53 +0800 diff --git a/debian/clean b/debian/clean new file mode 100644 index 0000000..6a16be1 --- /dev/null +++ b/debian/clean @@ -0,0 +1 @@ +.eggs/* diff --git a/debian/control b/debian/control index 93b5ddc..13f34cc 100644 --- a/debian/control +++ b/debian/control @@ -1,13 +1,46 @@ Source: python-xlib -Section: x11 -Priority: extra -Maintainer: Moshe Zadka -Build-Depends: debhelper -Standards-Version: 3.0.1 +Section: python +Priority: optional +Maintainer: openKylin Developers +Uploaders: Andrej Shadura , + Emmanuel Arias , +Build-Depends: debhelper-compat (= 13), + dh-python, + dos2unix, + python3-all, + python3-mock , + python3-setuptools, + python3-setuptools-scm, + python3-six , + python3-tomli, + texinfo, + xauth , + xvfb , +Standards-Version: 4.6.2 +Homepage: https://github.com/python-xlib/python-xlib +Vcs-Git: https://salsa.debian.org/python-team/packages/python-xlib.git +Vcs-Browser: https://salsa.debian.org/python-team/packages/python-xlib +Rules-Requires-Root: no -Package: python-xlib +Package: python3-xlib Architecture: all -Depends: python -Description: Interface for Python to the X11 Protocol - python-xlib is a 100% pure python implementation of the X11 - protocol. +Depends: ${misc:Depends}, + ${python3:Depends}, +Description: interface for Python 3 to the X11 protocol + python-xlib is a 100% pure Python 3 implementation of the X11 + protocol. It currently implements client-side X11R6 fully, supports + the resource database, ICCM, and the Shape extension. + +Package: python-xlib-doc +Architecture: all +Section: doc +Build-Profiles: +Depends: ${misc:Depends}, +Recommends: python3-xlib, +Multi-Arch: foreign +Description: interface for Python 3 to the X11 protocol (docs) + python-xlib is a 100% pure Python 3 implementation of the X11 + protocol. It currently implements client-side X11R6 fully, supports + the resource database, ICCM, and the Shape extension. + . + This package provides the documentation. diff --git a/debian/copyright b/debian/copyright index 669a907..a4f8c83 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,13 +1,116 @@ -This package was debianized by Moshe Zadka on -sun, 15 Jul 2001 13:03:04 +0300. +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: python-xlib +Source: https://github.com/python-xlib/python-Xlib -It was downloaded from http://python-xlib.sf.net +Files: * +Copyright: 2000-2013, Peter Liljenberg +License: LGPL-2.1+ -Upstream Author(s): Peter Liljenberg +Files: + Xlib/ext/ge.py + Xlib/ext/security.py + Xlib/ext/xfixes.py + Xlib/ext/xinput.py + examples/eventthread.py + examples/security.py + examples/xfixes.py + examples/xinput.py +Copyright: 2010-2013, Outpost Embedded, LLC +License: LGPL-2.1+ +Files: Xlib/ext/damage.py +Copyright: 2018, Joseph Kogut +License: LGPL-2.1+ + +Files: + Xlib/ext/nvcontrol.py + examples/nvcontrol.py +Copyright: 2019, Roberto Leinardi +License: LGPL-2.1+ + +Files: + Xlib/ext/randr.py + Xlib/ext/xinerama.py +Copyright: 2006, Mike Meyer +License: LGPL-2.1+ + +Files: + Xlib/ext/record.py + examples/record_demo.py +Copyright: 2006, Alex Badea +License: LGPL-2.1+ + +Files: examples/childwin.py Copyright: + 2002, Peter Liljenberg + 2008, David Bronke +License: LGPL-2.1+ -Copyright (C) 2000,2001 Peter Liljenberg +Files: examples/run_examples.py +Copyright: 2016, Svetlana Filicheva +License: LGPL-2.1+ -The Python X Library is released under GPL, see the file COPYING for -details. +Files: examples/xdamage.py +Copyright: 2019, Mohit Garg +License: LGPL-2.1+ + +Files: examples/xfixes-selection-notify.py +Copyright: 2019, Tony Crisci +License: LGPL-2.1+ + +Files: + examples/xinerama.py + examples/xrandr.py +Copyright: 2009, David H. Bronke +License: LGPL-2.1+ + +Files: examples/xlsatoms.py +Copyright: 2011, Arun Balasubramanian +License: LGPL-2.1+ + +Files: + Xlib/ext/res.py + examples/xres.py +Copyright: 2021, Aleksei Bavshin +License: LGPL-2.1+ + +Files: Xlib/ext/dpms.py + examples/dpms.py +Copyright: 2020, Thiago Kenji Okada +License: LGPL-2.1+ + +Files: examples/xfixes-cursor-notify.py +Copyright: 2022, Dan Isla +License: LGPL-2.1+ + +Files: Xlib/ext/screensaver.py +Copyright: 2022, Vladimir Panteleev +License: LGPL-2.1+ + +Files: debian/* +Copyright: + 2001, 2002, Moshe Zadka + 2001, 2002, Gregor Hoffleit + 2005, Martin v. Löwis + 2007-2009, Mike O'Connor + 2015, 2017-2020, Andrej Shadura + 2022, Arias Emmanuel +License: LGPL-2.1+ + +License: LGPL-2.1+ + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + . + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + . + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU Lesser General + Public License version 2.1 can be found in + `/usr/share/common-licenses/LGPL-2.1'. diff --git a/debian/dirs b/debian/dirs deleted file mode 100644 index 9d185ee..0000000 --- a/debian/dirs +++ /dev/null @@ -1,5 +0,0 @@ -usr/lib/python1.5/site-packages/Xlib -usr/share/info -usr/share/doc/python-xlib/ -usr/share/doc/python-xlib/examples -usr/share/doc/python-xlib/html diff --git a/debian/patches/0004-Use-context-manager-to-avoid-error-in-test.patch b/debian/patches/0004-Use-context-manager-to-avoid-error-in-test.patch new file mode 100644 index 0000000..178eec1 --- /dev/null +++ b/debian/patches/0004-Use-context-manager-to-avoid-error-in-test.patch @@ -0,0 +1,29 @@ +From: Emmanuel Arias +Date: Wed, 6 Jul 2022 18:10:50 -0300 +Subject: Use context manager to avoid error in test. + +Use context manager in tests to avoid an error during the Build in +Debian. + +Forwarded: https://github.com/python-xlib/python-xlib/issues/231 +Bug-Debian: https://bugs.debian.org/1006033 +--- + test/test_xlib_display.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +Index: python-xlib/test/test_xlib_display.py +=================================================================== +--- python-xlib.orig/test/test_xlib_display.py 2022-12-30 22:10:10.388738608 -0300 ++++ python-xlib/test/test_xlib_display.py 2022-12-30 22:10:33.357010879 -0300 +@@ -52,8 +52,9 @@ + self.assertEqual(str(self.display.display.socket_error), "Display connection closed by client") + + def test_can_close_display_and_check_for_error(self): +- self.display.close() +- self.assertRaises(Xlib.error.ConnectionClosedError, self.display.flush) ++ with self.assertRaises(Xlib.error.ConnectionClosedError): ++ self.display.close() ++ self.display.flush() + + def test_return_fileno(self): + self.assertTrue(isinstance(self.display.fileno(), int)) diff --git a/debian/patches/add-texinfo-dir-entry.patch b/debian/patches/add-texinfo-dir-entry.patch new file mode 100644 index 0000000..65df31c --- /dev/null +++ b/debian/patches/add-texinfo-dir-entry.patch @@ -0,0 +1,18 @@ +Index: python-xlib/doc/src/python-xlib.texi +=================================================================== +--- python-xlib.orig/doc/src/python-xlib.texi 2022-12-30 20:42:27.631073899 -0300 ++++ python-xlib/doc/src/python-xlib.texi 2022-12-30 20:47:01.218479601 -0300 +@@ -39,6 +39,13 @@ + translation approved by the Free Software Foundation. + @end ifinfo + ++@ifinfo ++@dircategory Python ++@direntry ++* python-xlib: (python-xlib). Interface for Python to the X11 Protocol ++@end direntry ++@end ifinfo ++ + @titlepage + @title The Python X Library + @author Peter Liljenberg diff --git a/debian/patches/fix-ssh-tunnel-auth.patch b/debian/patches/fix-ssh-tunnel-auth.patch new file mode 100644 index 0000000..d888b95 --- /dev/null +++ b/debian/patches/fix-ssh-tunnel-auth.patch @@ -0,0 +1,18 @@ +Index: python-xlib/Xlib/support/unix_connect.py +=================================================================== +--- python-xlib.orig/Xlib/support/unix_connect.py 2022-12-30 20:47:39.970961940 -0300 ++++ python-xlib/Xlib/support/unix_connect.py 2022-12-30 20:50:19.204944041 -0300 +@@ -211,6 +211,13 @@ + auth_data = auth + except os.error: + pass ++ if not auth_data and host=='localhost': ++ # 127.0.0.1 counts as FamilyLocal, not FamilyInternet ++ # See Xtransutil.c:ConvertAddress. ++ # There might be more ways to spell 127.0.0.1 but ++ # 'localhost', yet this code fixes a the case of ++ # OpenSSH tunneling X. ++ return get_auth('unix:%d' % dno, 'unix', dno) + + return auth_name, auth_data + diff --git a/debian/patches/inherit-XError-in-error-classes-in-randr.patch b/debian/patches/inherit-XError-in-error-classes-in-randr.patch new file mode 100644 index 0000000..84ff075 --- /dev/null +++ b/debian/patches/inherit-XError-in-error-classes-in-randr.patch @@ -0,0 +1,65 @@ +From 52800b1925c0e15a6d97487750db490f064376d8 Mon Sep 17 00:00:00 2001 +From: Frans Klaver +Date: Tue, 8 Nov 2022 12:20:14 +0100 +Subject: [PATCH] randr: inherit XError in error classes + +Commit c87624dd6 ('Add Randr error classes and register them during +init') introduces three new error classes to xrandr, but makes them +inherit from Exception. + +Let all error classes in randr inherit from Xerror, like all other code +expects. + +Fixes the traceback + +``` +... + File "/tmp/python-env/lib/python3.8/site-packages/Xlib/display.py", line 182, in sync + self.get_pointer_control() + File "/tmp/python-env/lib/python3.8/site-packages/Xlib/display.py", line 833, in get_pointer_control + return request.GetPointerControl(display = self.display) + File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/rq.py", line 1369, in __init__ + self.reply() + File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/rq.py", line 1381, in reply + self._display.send_and_recv(request = self._serial) + File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/display.py", line 612, in send_and_recv + gotreq = self.parse_response(request) + File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/display.py", line 719, in parse_response + gotreq = self.parse_error_response(request) or gotreq + File "/tmp/python-env/lib/python3.8/site-packages/Xlib/protocol/display.py", line 745, in parse_error_response + req = self.get_waiting_request(e.sequence_number) +AttributeError: 'BadRRModeError' object has no attribute 'sequence_number' +``` + +fixes #241 +--- + Xlib/ext/randr.py | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/Xlib/ext/randr.py b/Xlib/ext/randr.py +index 9cbfe2d..515703b 100644 +--- a/Xlib/ext/randr.py ++++ b/Xlib/ext/randr.py +@@ -36,6 +36,7 @@ + + from Xlib import X + from Xlib.protocol import rq ++from Xlib.error import XError + + extname = 'RANDR' + +@@ -123,11 +124,11 @@ + BadRRMode = 2 + + # Error classes # +-class BadRROutputError(Exception): pass ++class BadRROutputError(XError): pass + +-class BadRRCrtcError(Exception): pass ++class BadRRCrtcError(XError): pass + +-class BadRRModeError(Exception): pass ++class BadRRModeError(XError): pass + + # Data Structures # + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..fd689e9 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,5 @@ +add-texinfo-dir-entry.patch +fix-ssh-tunnel-auth.patch +texi2html.patch +0004-Use-context-manager-to-avoid-error-in-test.patch +inherit-XError-in-error-classes-in-randr.patch diff --git a/debian/patches/texi2html.patch b/debian/patches/texi2html.patch new file mode 100644 index 0000000..087d15f --- /dev/null +++ b/debian/patches/texi2html.patch @@ -0,0 +1,16 @@ +From: Andrej Shadura +Subject: Use makeinfo instead of texi2html + +Index: python-xlib/doc/html/Makefile +=================================================================== +--- python-xlib.orig/doc/html/Makefile 2022-12-30 21:45:59.027404118 -0300 ++++ python-xlib/doc/html/Makefile 2022-12-30 21:46:06.267491630 -0300 +@@ -3,7 +3,7 @@ + include ../src/defs + + python-xlib_toc.html: $(SRCS) +- texi2html --output=. --split=node --menu $(TOPSRC) ++ makeinfo --output=. --html --split=node $(TOPSRC) + ln -sf python-xlib_toc.html index.html + + clean: diff --git a/debian/postinst b/debian/postinst deleted file mode 100644 index 20d6ad3..0000000 --- a/debian/postinst +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -if [ "$1" = "configure" -o "$1" = "upgrade" ]; then - install-info --section "Development" "Development" --quiet /usr/share/info/python-xlib.info -fi - -if [ "$1" = "configure" ]; then - if [ -d /usr/doc -a ! -e /usr/doc/python-xlib -a -d /usr/share/doc/python-xlib ]; then - ln -sf ../share/doc/python-xlib /usr/doc/python-xlib - fi -fi - -NAME=python-xlib -case "$1" in - configure|abort-upgrade|abort-remove|abort-deconfigure) - dpkg --listfiles $NAME | grep '\.py$' | \ - xargs -n 1 /usr/bin/python -c 'import py_compile,sys;py_compile.compile(sys.argv[1])' - dpkg --listfiles $NAME | grep '\.py$' | \ - xargs -n 1 /usr/bin/python -O -c 'import py_compile,sys;py_compile.compile(sys.argv[1])' - ;; -esac diff --git a/debian/prerm b/debian/prerm deleted file mode 100644 index 1ac30d2..0000000 --- a/debian/prerm +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -if [ "$1" = "remove" -o "$1" = "upgrade" ]; then - install-info --quiet --remove /usr/share/info/python-xlib.info -fi - -NAME=python-xlib - -dpkg --listfiles $NAME | - awk '$0~/\.py$/ {print $0"c\n" $0"o"}' | - xargs rm -f >&2 - -if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/python-xlib ]; then - rm -f /usr/doc/python-xlib -fi diff --git a/debian/python-xlib-doc.doc-base b/debian/python-xlib-doc.doc-base new file mode 100644 index 0000000..436cc64 --- /dev/null +++ b/debian/python-xlib-doc.doc-base @@ -0,0 +1,9 @@ +Document: python-xlib +Title: python-xlib documentation +Author: Peter Liljenberg +Abstract: Interface for Python3 to the X11 protocol +Section: Programming/Python + +Format: HTML +Index: /usr/share/doc/python-xlib-doc/html/index.html +Files: /usr/share/doc/python-xlib-doc/html/*.html diff --git a/debian/python-xlib-doc.docs b/debian/python-xlib-doc.docs new file mode 100644 index 0000000..839ed27 --- /dev/null +++ b/debian/python-xlib-doc.docs @@ -0,0 +1,3 @@ +README.rst +TODO +doc/html diff --git a/debian/python-xlib-doc.examples b/debian/python-xlib-doc.examples new file mode 100644 index 0000000..e39721e --- /dev/null +++ b/debian/python-xlib-doc.examples @@ -0,0 +1 @@ +examples/* diff --git a/debian/rules b/debian/rules old mode 100644 new mode 100755 index dd820f1..b0b9956 --- a/debian/rules +++ b/debian/rules @@ -1,67 +1,38 @@ #!/usr/bin/make -f #-*- makefile -*- -# Made with the aid of dh_make, by Craig Small -# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. -# Some lines taken from debmake, by Christoph Lameter. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -# This is the debhelper compatibility version to use. -export DH_COMPAT=1 +export PYBUILD_NAME=xlib -build: build-stamp -build-stamp: - dh_testdir +%: + dh $@ --with python3 --buildsystem=pybuild - touch build-stamp +override_dh_auto_build: + dh_auto_build + make -C doc html + # for some reason makeinfo doesn’t create toc on the first run + make -C doc html -clean: - dh_testdir - dh_testroot - rm -f build-stamp install-stamp +override_dh_auto_clean: + dh_auto_clean + make -C doc clean - # Add here commands to clean up after the build process. - dh_clean +override_dh_auto_install: + dh_auto_install + find debian/python3-xlib -name '*.py' -print0 | xargs -0 dos2unix -q -install: install-stamp -install-stamp: build-stamp - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs +override_dh_installdocs: + dh_installdocs + rm -f debian/*/usr/share/doc/*/*/Makefile - # Add here commands to install the package into debian/tmp. - cp -r Xlib debian/tmp/usr/lib/python1.5/site-packages/ - cp README NEWS TODO debian/tmp/usr/share/doc/python-xlib - cp doc/html/*.html debian/tmp/usr/share/doc/python-xlib/html - cp doc/info/*.info debian/tmp/usr/share/info - gzip -9 debian/tmp/usr/share/info/python-xlib.info - cp examples/*.py debian/tmp/usr/share/doc/python-xlib/examples - cp debian/copyright debian/tmp/usr/share/doc/python-xlib/ +override_dh_compress: + dh_compress -X.py - touch install-stamp +override_dh_auto_test: +ifeq (,$(filter nocheck, $(DEB_BUILD_OPTIONS))) + xvfb-run dh_auto_test +endif -binary-arch: build install -# We have nothing to do by default. - -binary-indep: build install -# dh_testversion - dh_testdir - dh_testroot - dh_link - dh_strip - dh_installchangelogs - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -source diff: - @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install +.PHONY: override_dh_auto_build override_dh_auto_clean override_dh_compress diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml new file mode 100644 index 0000000..33c3a64 --- /dev/null +++ b/debian/salsa-ci.yml @@ -0,0 +1,4 @@ +--- +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..f6d9166 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,8 @@ +Tests: unittests +Depends: + python3-all, + xauth, + xvfb, + python3-mock, + @, +Restrictions: allow-stderr diff --git a/debian/tests/unittests b/debian/tests/unittests new file mode 100644 index 0000000..2942fb4 --- /dev/null +++ b/debian/tests/unittests @@ -0,0 +1,13 @@ +#! /bin/sh + +set -efu + +cp -r test/ "$AUTOPKGTEST_TMP" +cd "$AUTOPKGTEST_TMP" + +PYS=$(py3versions -s) +for py in $PYS; do + echo "Testing with $py:" + + xvfb-run --auto-servernum --server-num=1 $py -m unittest discover -v +done diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 0000000..4f0e277 --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,4 @@ +Bug-Database: https://github.com/python-xlib/python-xlib/issues +Bug-Submit: https://github.com/python-xlib/python-xlib/issues/new +Repository: https://github.com/python-xlib/python-xlib.git +Repository-Browse: https://github.com/python-xlib/python-xlib diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..2d5c8c1 --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=4 +opts="pgpmode=none, filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%@python-xlib@-$1.tar.gz%" \ +https://github.com/python-xlib/python-xlib/tags (?:.*?/)?v?(\d[\d.]*)\.tar\.gz