Initial commit

This commit is contained in:
2026-07-09 14:17:07 +03:00
commit e5a8a5625a
6 changed files with 103 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
# Ignore BPM archives and signatures
*.bpm
*.bpm.sig
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
# Github repository
REPO="python-xlib/python-xlib"
# Get tag name using Github Rest API
TAG_NAME=$(curl -s -L -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/"$REPO"/releases/latest | jq -r '.tag_name')
echo "$TAG_NAME"
+23
View File
@@ -0,0 +1,23 @@
name: python-xlib
description: A fully functional X client library for Python programs
version: "0.33"
revision: 1
url: https://github.com/python-xlib/python-xlib
license: LGPL-2.1-or-later
maintainers:
- [email protected]
architecture: any
output_architecture: any
type: source
depends:
- python-six
make_depends:
- python-build
- python-installer
- python-setuptools-scm
- python-wheel
downloads:
- url: https://github.com/python-xlib/python-xlib/archive/refs/tags/${BPM_PKG_VERSION}.tar.gz
extract_to: ${BPM_SOURCE}
extract_strip_components: 1
checksum: e10d1b49655800bffe0fbb5eb31eeef915a4421952ef006d468d53d34901f6f8
+26
View File
@@ -0,0 +1,26 @@
# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
# The prepare function is executed in the root of the temp directory
# This function is used for putting downloaded files to the correct location or applying patches
prepare() {
cd "$BPM_SOURCE"
patch -Np1 -i "$BPM_WORKDIR"/mock.patch
patch -Np1 -i "$BPM_WORKDIR"/handle-missing-pkg_resources-import.patch
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
python3 -m build --wheel --no-isolation .
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
python3 -m installer --destdir="$BPM_OUTPUT" dist/*.whl
# Install package license
install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/python-xlib/LICENSE
}
@@ -0,0 +1,19 @@
--- a/setup.py
+++ b/setup.py
@@ -1,12 +1,13 @@
# Distutils script for python-xlib
-from pkg_resources import parse_requirements
+from packaging.requirements import Requirement
from setuptools import (__version__ as setuptools_version, setup)
# Check setuptools is recent enough to support `setup.cfg`.
-setuptools_require = next(parse_requirements('setuptools>=30.3.0'))
-assert setuptools_version in setuptools_require, '{} is required'.format(setuptools_require)
+setuptools_require = Requirement('setuptools>=30.3.0')
+assert setuptools_require.specifier.contains(setuptools_version), \
+ '{} is required (found {})'.format(setuptools_require, setuptools_version)
setup(
+23
View File
@@ -0,0 +1,23 @@
diff --git a/dev-requirements.txt b/dev-requirements.txt
index b2f5288..22fc710 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,5 +1,4 @@
coverage
codecov
-mock
nose
setuptools-scm
diff --git a/test/test_unix_connect.py b/test/test_unix_connect.py
index 7680ba5..82e9f01 100644
--- a/test/test_unix_connect.py
+++ b/test/test_unix_connect.py
@@ -6,7 +6,7 @@ import socket
import sys
import unittest
-from mock import patch
+from unittest.mock import patch
from Xlib.support import unix_connect
from Xlib.error import DisplayConnectionError, DisplayNameError