update code
This commit is contained in:
commit
c57284fd65
67
0002-Specify-prototypes-for-used-X11-C-functions.patch
Normal file
67
0002-Specify-prototypes-for-used-X11-C-functions.patch
Normal file
@ -0,0 +1,67 @@
|
||||
From a076837517074986ba4253d2dd8328356729ff20 Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Wed, 29 Jul 2015 14:23:34 +0200
|
||||
Subject: [PATCH] Specify prototypes for used X11 C functions
|
||||
|
||||
Python does not magically resolve types of C functions imported through
|
||||
ctypes. Without specifying their prototypes the return type of all
|
||||
functions is c_int and all Python int arguments are converted to C int
|
||||
arguments.
|
||||
|
||||
The return type of XOpenDisplay is 'Display *', so the correct return type is
|
||||
'c_void_p'.
|
||||
|
||||
The argument type of XCloseDisplay is 'Display *', so the correct
|
||||
argument type is 'c_void_p' too.
|
||||
|
||||
Without this patch, the pointers returned from XOpenDisplay and passed
|
||||
to XCloseDisplay are truncated to int, which is shorter than 'void *' on
|
||||
some architectures, and that causes unpredicted behavior which leads to
|
||||
a crash.
|
||||
|
||||
Related: bugzilla.redhat.com/1244261
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/fros | 14 +++++++++++---
|
||||
1 file changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/fros b/src/fros
|
||||
index 56b4070..22a62b8 100755
|
||||
--- a/src/fros
|
||||
+++ b/src/fros
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
import sys
|
||||
-from ctypes import cdll, util
|
||||
+from ctypes import cdll, util, c_void_p, c_char_p
|
||||
|
||||
XLIB_PATH = util.find_library('X11')
|
||||
if not XLIB_PATH:
|
||||
@@ -27,12 +27,20 @@ if not XLIB_PATH:
|
||||
sys.exit(1)
|
||||
|
||||
XLIB = cdll.LoadLibrary(XLIB_PATH)
|
||||
-DISPLAY = XLIB.XOpenDisplay(None)
|
||||
+
|
||||
+XOpenDisplay = XLIB.XOpenDisplay
|
||||
+XOpenDisplay.argtypes = [c_char_p]
|
||||
+XOpenDisplay.restype = c_void_p
|
||||
+
|
||||
+DISPLAY = XOpenDisplay(None)
|
||||
if DISPLAY == 0:
|
||||
sys.stderr.write("Cannot connect to X server\n")
|
||||
sys.exit(2)
|
||||
|
||||
-XLIB.XCloseDisplay(DISPLAY)
|
||||
+XCloseDisplay = XLIB.XCloseDisplay
|
||||
+XCloseDisplay.argtypes = [c_void_p]
|
||||
+
|
||||
+XCloseDisplay(DISPLAY)
|
||||
|
||||
from pyfros.froslogging import error, info, set_verbosity
|
||||
from pyfros.controls import Controls
|
||||
--
|
||||
2.4.6
|
||||
|
||||
33
0004-Switch-to-XDG_CURRENT_DESKTOP.patch
Normal file
33
0004-Switch-to-XDG_CURRENT_DESKTOP.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 1742464ca9e86044309041070ad2597f6723901a Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Mon, 24 Aug 2015 09:57:33 +0200
|
||||
Subject: [PATCH] Switch to XDG_CURRENT_DESKTOP
|
||||
|
||||
The environment variable is not documented (or at least I cannot find any
|
||||
official documentation), the environment variable is used by all major
|
||||
Dekstop vendors though (just try to ask google to search for its name).
|
||||
|
||||
Related rhbz#1194976
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/pyfros/plugins/screencastgnome.py | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/pyfros/plugins/screencastgnome.py b/src/pyfros/plugins/screencastgnome.py
|
||||
index 7bf5105..d752c31 100644
|
||||
--- a/src/pyfros/plugins/screencastgnome.py
|
||||
+++ b/src/pyfros/plugins/screencastgnome.py
|
||||
@@ -149,7 +149,8 @@ class ScreencastGnome(ScreencastBase):
|
||||
end_handler()
|
||||
|
||||
def IsSuitable(self):
|
||||
- if "gnome" in os.getenv("DESKTOP_SESSION"):
|
||||
+ if os.environ.get('XDG_CURRENT_DESKTOP') in \
|
||||
+ ['GNOME', 'GNOME-Classic:GNOME', 'GNOME-Classic']:
|
||||
return const.SUITABLE_PREFERED
|
||||
else:
|
||||
return const.SUITABLE_NOT_SUITABLE
|
||||
--
|
||||
2.5.0
|
||||
|
||||
36
0005-Ensure-that-the-right-version-of-Gtk-gets-loaded.patch
Normal file
36
0005-Ensure-that-the-right-version-of-Gtk-gets-loaded.patch
Normal file
@ -0,0 +1,36 @@
|
||||
From ab4c282729847338e97d236342d21fabd7cfb3aa Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Mon, 24 Aug 2015 10:28:39 +0200
|
||||
Subject: [PATCH] Ensure that the right version of Gtk gets loaded
|
||||
|
||||
As suggested by PyGIWarning:
|
||||
|
||||
/usr/lib/python3.4/site-packages/pyfros/controls.py:22: PyGIWarning:
|
||||
Gtk was imported without specifying a version first. Use
|
||||
gi.require_version('Gtk', '3.0') before import to ensure that the
|
||||
right version gets loaded.
|
||||
from gi.repository import Gtk
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/pyfros/controls.py | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/pyfros/controls.py b/src/pyfros/controls.py
|
||||
index 0593ef7..b64cf8b 100644
|
||||
--- a/src/pyfros/controls.py
|
||||
+++ b/src/pyfros/controls.py
|
||||
@@ -15,6 +15,10 @@
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
||||
|
||||
+# As suggested by a PyGIWarning
|
||||
+import gi
|
||||
+gi.require_version('Gtk', '3.0')
|
||||
+
|
||||
# pylint has troubles importing from gi.repository because
|
||||
# it uses introspection
|
||||
# pylint: disable=E0611
|
||||
--
|
||||
2.5.0
|
||||
|
||||
@ -0,0 +1,94 @@
|
||||
From 727d4e349409d5b45903faa169662cdeff381903 Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Mon, 24 Aug 2015 15:00:36 +0200
|
||||
Subject: [PATCH] Delay initialization of GNOME Screencast D-Bus proxy
|
||||
|
||||
Related: rhbz#1197607, rhbz#1197997, rhbz#1199242
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/pyfros/plugins/screencastgnome.py | 50 ++++++++++++++++++++++-------------
|
||||
1 file changed, 32 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/src/pyfros/plugins/screencastgnome.py b/src/pyfros/plugins/screencastgnome.py
|
||||
index d752c31..84a5443 100644
|
||||
--- a/src/pyfros/plugins/screencastgnome.py
|
||||
+++ b/src/pyfros/plugins/screencastgnome.py
|
||||
@@ -102,6 +102,7 @@
|
||||
</interface>
|
||||
"""
|
||||
from pyfros.screencastbase import ScreencastBase, ScreencastResult
|
||||
+from pyfros.froslogging import info, error
|
||||
import pyfros.plugins.const as const
|
||||
import dbus
|
||||
import os
|
||||
@@ -120,35 +121,48 @@ class ScreencastGnome(ScreencastBase):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ScreencastGnome, self).__init__(*args, **kwargs)
|
||||
- bus = dbus.SessionBus()
|
||||
- self._proxy = dbus.Interface(
|
||||
- bus.get_object(
|
||||
- BUS_NAME, BUS_PATH,
|
||||
- follow_name_owner_changes=False
|
||||
- ),
|
||||
- BUS_IFACE
|
||||
- )
|
||||
-
|
||||
+ self._proxy = None
|
||||
self.output = os.path.join(os.getcwd(), "screencast-%d-%t.webm")
|
||||
|
||||
+ def _backend(self):
|
||||
+ if self._proxy is None:
|
||||
+ bus = dbus.SessionBus()
|
||||
+ obj = bus.get_object(BUS_NAME, BUS_PATH, follow_name_owner_changes=False)
|
||||
+ self._proxy = dbus.Interface(obj, BUS_IFACE)
|
||||
+
|
||||
+ return self._proxy
|
||||
+
|
||||
def Screencast(self):
|
||||
- succ, filename = self._proxy.ScreencastArea(self.x,
|
||||
- self.y,
|
||||
- self.width,
|
||||
- self.height,
|
||||
- self.output,
|
||||
- {"framerate": 5}
|
||||
- )
|
||||
- return ScreencastResult(succ, filename)
|
||||
+ try:
|
||||
+ succ, filename = self._backend().ScreencastArea(self.x,
|
||||
+ self.y,
|
||||
+ self.width,
|
||||
+ self.height,
|
||||
+ self.output,
|
||||
+ {"framerate": 5}
|
||||
+ )
|
||||
+ return ScreencastResult(succ, filename)
|
||||
+ except dbus.exceptions.DBusException as ex:
|
||||
+ error("Failed to start GNOME screencasting: %s" % (str(ex)))
|
||||
+ return ScreencastResult(False, None)
|
||||
|
||||
def ScreencastArea(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def StopScreencast(self, end_handler):
|
||||
- self._proxy.StopScreencast()
|
||||
+ try:
|
||||
+ self._backend().StopScreencast()
|
||||
+ except dbus.exceptions.DBusException as ex:
|
||||
+ error("Failed to stop GNOME screencasting: %s" % (str(ex)))
|
||||
end_handler()
|
||||
|
||||
def IsSuitable(self):
|
||||
+ try:
|
||||
+ self._backend()
|
||||
+ except dbus.exceptions.DBusException as ex:
|
||||
+ info("D-Bus GNOME Screencaster is not available: %s" % (str(ex)))
|
||||
+ return const.SUITABLE_NOT_SUITABLE
|
||||
+
|
||||
if os.environ.get('XDG_CURRENT_DESKTOP') in \
|
||||
['GNOME', 'GNOME-Classic:GNOME', 'GNOME-Classic']:
|
||||
return const.SUITABLE_PREFERED
|
||||
--
|
||||
2.5.0
|
||||
|
||||
50
0007-Add-a-sanity-check-to-recordmydestkop-plugin.patch
Normal file
50
0007-Add-a-sanity-check-to-recordmydestkop-plugin.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From 915a63da5e94f85a8f0a211c73f9fafa77bc31f4 Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Mon, 24 Aug 2015 15:26:03 +0200
|
||||
Subject: [PATCH] Add a sanity check to 'recordmydestkop' plugin
|
||||
|
||||
Related: rhbz#1228860
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/pyfros/plugins/screencastrecordmydesktop.py | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/pyfros/plugins/screencastrecordmydesktop.py b/src/pyfros/plugins/screencastrecordmydesktop.py
|
||||
index 376b52b..63efd7d 100644
|
||||
--- a/src/pyfros/plugins/screencastrecordmydesktop.py
|
||||
+++ b/src/pyfros/plugins/screencastrecordmydesktop.py
|
||||
@@ -17,14 +17,14 @@
|
||||
|
||||
from pyfros.screencastbase import ScreencastBase, ScreencastResult
|
||||
import pyfros.plugins.const as const
|
||||
-from subprocess import Popen, PIPE
|
||||
+from subprocess import Popen, PIPE, DEVNULL
|
||||
import fcntl
|
||||
import os
|
||||
import signal
|
||||
#pylint: disable=E0611
|
||||
from gi.repository import GLib
|
||||
import re
|
||||
-from pyfros.froslogging import warn
|
||||
+from pyfros.froslogging import warn, error
|
||||
|
||||
|
||||
def getScreencastPluginInstance():
|
||||
@@ -95,6 +95,13 @@ class ScreencastRecordMyDesktop(ScreencastBase):
|
||||
print("ScreencastArea ScreencastRecordMyDesktop")
|
||||
|
||||
def IsSuitable(self):
|
||||
+ try:
|
||||
+ proc = Popen(["recordmydesktop", "-h"], stdin=DEVNULL, stdout=DEVNULL, stderr=DEVNULL)
|
||||
+ proc.communicate()
|
||||
+ except Exception as ex:
|
||||
+ error("Cannot run 'recordmydesktop': %s" % (str(ex)))
|
||||
+ return const.SUITABLE_NOT_SUITABLE
|
||||
+
|
||||
return const.SUITABLE_DEFAULT # 1 is default
|
||||
|
||||
def Screencast(self):
|
||||
--
|
||||
2.5.0
|
||||
|
||||
BIN
fros-1.1-30275a0.tar.gz
Normal file
BIN
fros-1.1-30275a0.tar.gz
Normal file
Binary file not shown.
66
fros.spec
Normal file
66
fros.spec
Normal file
@ -0,0 +1,66 @@
|
||||
%global commit 30275a07dab7891b9f31ff115743f67d757c7c1a
|
||||
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||
|
||||
Name: fros
|
||||
Version: 1.1
|
||||
Release: 18
|
||||
Summary: Universal screencasting frontend with pluggable support for various backends
|
||||
License: GPLv2+
|
||||
URL: https://github.com/mozeq/fros
|
||||
# this url is wrong, because github doesn't offer a space for downloadable archives
|
||||
Source: https://github.com/mozeq/fros/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz
|
||||
|
||||
Patch0002: 0002-Specify-prototypes-for-used-X11-C-functions.patch
|
||||
Patch0004: 0004-Switch-to-XDG_CURRENT_DESKTOP.patch
|
||||
Patch0005: 0005-Ensure-that-the-right-version-of-Gtk-gets-loaded.patch
|
||||
Patch0006: 0006-Delay-initialization-of-GNOME-Screencast-D-Bus-proxy.patch
|
||||
Patch0007: 0007-Add-a-sanity-check-to-recordmydestkop-plugin.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
BuildRequires: python3-devel python3-setuptools
|
||||
Requires: python3-gobject
|
||||
|
||||
Provides: %{name}-recordmydesktop %{name}-gnome
|
||||
Obsoletes: %{name}-recordmydesktop %{name}-gnome
|
||||
|
||||
%description
|
||||
Universal screencasting frontend with pluggable support for various backends.
|
||||
The goal is to provide an unified access to as many screencasting backends as
|
||||
possible while still keeping the same user interface so the user experience
|
||||
while across various desktops and screencasting programs is seamless.
|
||||
|
||||
%package_help
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{commit} -p1
|
||||
|
||||
%build
|
||||
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
|
||||
|
||||
%install
|
||||
%{__python3} setup.py install --skip-build --root %{buildroot}
|
||||
|
||||
%check
|
||||
%{__python3} setup.py test
|
||||
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc COPYING
|
||||
%{_bindir}/fros
|
||||
%{python3_sitelib}/pyfros/*.py*
|
||||
%{python3_sitelib}/pyfros/__pycache__/*.cpython-%{python3_version_nodots}.*py*
|
||||
%{python3_sitelib}/pyfros/plugins/*
|
||||
%{python3_sitelib}/%{name}-%{version}-py%{python3_version}.egg-info/*
|
||||
|
||||
%files help
|
||||
%defattr(-,root,root)
|
||||
%doc README
|
||||
%{_mandir}/man1/%{name}.1*
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Oct 11 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.1-18
|
||||
- Package init
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user