14
0
forked from pool/python-wmctrl
2020-10-26 09:15:45 +00:00
committed by Git OBS Bridge
commit 5577c11570
7 changed files with 187 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2008-2020 Antonio Cuni
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

48
pr_3.patch Normal file
View File

@@ -0,0 +1,48 @@
From c92ac1ea187c9a407156705bd1b0de8afd2530e1 Mon Sep 17 00:00:00 2001
From: John Vandenberg <jayvdb@gmail.com>
Date: Mon, 26 Oct 2020 13:05:53 +0700
Subject: [PATCH] Python 3 support
Fixes https://github.com/antocuni/wmctrl/issues/2
---
wmctrl.py | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
Index: wmctrl-0.3/wmctrl.py
===================================================================
--- wmctrl-0.3.orig/wmctrl.py
+++ wmctrl-0.3/wmctrl.py
@@ -1,5 +1,10 @@
import os
-from commands import getoutput
+
+try:
+ from commands import getoutput
+except ImportError:
+ from subprocess import getoutput
+
try:
from collections import namedtuple
except ImportError:
@@ -15,8 +20,8 @@ class Window(BaseWindow):
windows = []
for line in out.splitlines():
parts = line.split(None, len(Window._fields)-2)
- parts = map(str.strip, parts)
- parts[1:7] = map(int, parts[1:7])
+ parts = list(map(str.strip, parts))
+ parts[1:7] = list(map(int, parts[1:7]))
parts.append(_wm_window_role(parts[0]))
windows.append(cls(*parts))
return windows
@@ -68,8 +73,8 @@ class Window(BaseWindow):
def set_geometry(self, geometry):
dim, pos = geometry.split('+', 1)
- w, h = map(int, dim.split('x'))
- x, y = map(int, pos.split('+'))
+ w, h = list(map(int, dim.split('x')))
+ x, y = list(map(int, pos.split('+')))
self.resize_and_move(x, y, w, h)
def set_properties(self,properties):

3
wmctrl-0.3.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d806f65ac1554366b6e31d29d7be2e8893996c0acbb2824bbf2b1f49cf628a13
size 2505

12
wmctrl.changes Normal file
View File

@@ -0,0 +1,12 @@
-------------------------------------------------------------------
Mon Oct 26 04:41:39 UTC 2020 - John Vandenberg <jayvdb@gmail.com>
- Add pr_3.patch to fix Python 3
- Activate test suite
- Update URL from Bitbucket to GitHub
- Add LICENSE from new upstream
-------------------------------------------------------------------
Thu Apr 11 15:25:22 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Initial spec for v0.3

79
wmctrl.spec Normal file
View File

@@ -0,0 +1,79 @@
#
# spec file for package wmctrl
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-wmctrl
Version: 0.3
Release: 0
Summary: Python programmatic control of X windows
License: MIT
Group: Development/Languages/Python
# Project is in the process of transitioning from Bitbucket to GitHub
URL: https://github.com/antocuni/wmctrl
Source: https://files.pythonhosted.org/packages/source/w/wmctrl/wmctrl-%{version}.tar.gz
Source1: https://raw.githubusercontent.com/antocuni/wmctrl/master/LICENSE
# Backport ofhttps://github.com/antocuni/wmctrl/pull/3
Patch0: pr_3.patch
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: openbox
BuildRequires: python-rpm-macros
BuildRequires: wmctrl
BuildRequires: xclock
BuildRequires: xfontsel
BuildRequires: xorg-x11-server
BuildRequires: xvfb-run
Requires: wmctrl
Requires: xorg-x11-server
BuildArch: noarch
%python_subpackages
%description
Python tool to programmatically control windows inside X.
%prep
%setup -q -n wmctrl-%{version}
%patch0 -p1
cp %{SOURCE1} .
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%{python_expand #
cat > /tmp/test_script.sh <<EOF
#!/bin/sh
openbox &
sleep 5
wmctrl -l -G -p -x
$python -m pytest -k 'not test_activate' test/test_wmctrl.py
EOF
chmod +x /tmp/test_script.sh
xvfb-run /tmp/test_script.sh
}
%files %{python_files}
%license LICENSE
%{python_sitelib}/*
%changelog