From 50451b3676f53665910937dcfdb6fccd6404bd45 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 12 Apr 2013 20:50:05 +0200 Subject: [PATCH 01/10] Fix etc install root --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9034f0e..4fd24a3 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ import os class install_pylock(distutils.command.install.install): def run(self): - distutils.dir_util.copy_tree('etc', os.path.join(self.root, '/etc'), + distutils.dir_util.copy_tree('etc', os.path.join(self.root, 'etc'), preserve_times=0, preserve_symlinks=1, verbose=1) distutils.command.install.install.run(self) From 02c0a2d32518da8dec9d13fb98c8764810936ebc Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 12 Apr 2013 21:19:57 +0200 Subject: [PATCH 02/10] More setup fixes --- po/POTFILES.in | 8 ++++++++ {bin => scripts}/pylock | 0 setup.py | 13 ++++++++----- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 po/POTFILES.in rename {bin => scripts}/pylock (100%) diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..8d634f0 --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,8 @@ +[encoding: UTF-8] +pylock/__init__.py +pylock/Main.py +pylock/Locker.py +pylock/Selection.py +pylock/pam.py +pylock/LockWindow.py +[type: gettext/glade]pylock/data/unlock.ui diff --git a/bin/pylock b/scripts/pylock similarity index 100% rename from bin/pylock rename to scripts/pylock diff --git a/setup.py b/setup.py index 4fd24a3..c6c80c7 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,8 @@ #!/usr/bin/env python3 -import distutils -import DistUtilsExtra.auto +import distutils.core +import distutils.command.install +from DistUtilsExtra.command import build_extra, build_i18n import os @@ -12,18 +13,20 @@ class install_pylock(distutils.command.install.install): distutils.command.install.install.run(self) -DistUtilsExtra.auto.setup( +distutils.core.setup( name = 'pylock', version = '1', - data_files = [], - packages = ['pylock'], package_data = { 'pylock': ['data/unlock.ui', 'data/bg.svg'], }, + scripts = ['scripts/pylock'], + cmdclass = { + 'build': build_extra.build_extra, + 'build_i18n': build_i18n.build_i18n, 'install': install_pylock, }, ) From 773eaa4350adb118a7dde17d7f293a11bb619a80 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 13 Apr 2013 05:14:58 +0200 Subject: [PATCH 03/10] Add a lot of information to setup.py, fix distribution --- .gitignore | 2 ++ MANIFEST.in | 2 ++ setup.py | 14 ++++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 MANIFEST.in diff --git a/.gitignore b/.gitignore index 41f3d6d..f52e251 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *~ __pycache__ /build +/dist +/MANIFEST diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..af9266b --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include etc/pylock.conf +include po/POTFILES.in po/pylock.pot po/*.po diff --git a/setup.py b/setup.py index c6c80c7..1690702 100755 --- a/setup.py +++ b/setup.py @@ -16,6 +16,11 @@ class install_pylock(distutils.command.install.install): distutils.core.setup( name = 'pylock', version = '1', + author = 'Matthias Schiffer', + author_email = 'mschiffer@universe-factory.net', + url = 'http://git.universe-factory.net/pylock/', + description = 'A lightweight screenlocker for X implemented in Python 3 using Gtk3', + license = 'BSD', packages = ['pylock'], package_data = { @@ -29,4 +34,13 @@ distutils.core.setup( 'build_i18n': build_i18n.build_i18n, 'install': install_pylock, }, + + provides = ['pylock'], + requires = [ + 'gi.repository.Gtk', + 'gi.repository.Gdk', + 'gi.repository.GdkX11', + 'gi.repository.GObject', + 'gi.repository.GLib', + ], ) From c54421cf554e649df450b07f9a25d4343ed2ca43 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 16 Apr 2013 10:34:09 +0200 Subject: [PATCH 04/10] Fix setup.py to not touch pylock.po --- setup.py | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 1690702..3f1c0b4 100755 --- a/setup.py +++ b/setup.py @@ -1,18 +1,43 @@ #!/usr/bin/env python3 import distutils.core +import distutils.command.build import distutils.command.install -from DistUtilsExtra.command import build_extra, build_i18n +import glob import os +class build_pylock(distutils.command.build.build): + def run(self): + distutils.command.build.build.run(self) + + data_files = self.distribution.data_files + if data_files is None: + # in case not data_files are defined in setup.py + self.distribution.data_files = data_files = [] + + for po_file in glob.glob("po/*.po"): + lang = os.path.basename(po_file[:-3]) + mo_dir = os.path.join("build", "mo", lang, "LC_MESSAGES") + mo_file = os.path.join(mo_dir, "%s.mo" % self.distribution.metadata.name) + if not os.path.exists(mo_dir): + os.makedirs(mo_dir) + cmd = ["msgfmt", po_file, "-o", mo_file] + po_mtime = os.path.getmtime(po_file) + mo_mtime = os.path.exists(mo_file) and os.path.getmtime(mo_file) or 0 + if po_mtime > mo_mtime: + self.spawn(cmd) + + targetpath = os.path.join("share/locale", lang, "LC_MESSAGES") + data_files.append((targetpath, (mo_file,))) + class install_pylock(distutils.command.install.install): def run(self): + distutils.command.install.install.run(self) + distutils.dir_util.copy_tree('etc', os.path.join(self.root, 'etc'), preserve_times=0, preserve_symlinks=1, verbose=1) - distutils.command.install.install.run(self) - distutils.core.setup( name = 'pylock', version = '1', @@ -30,8 +55,7 @@ distutils.core.setup( scripts = ['scripts/pylock'], cmdclass = { - 'build': build_extra.build_extra, - 'build_i18n': build_i18n.build_i18n, + 'build': build_pylock, 'install': install_pylock, }, From 63e84e940ef8fb417076ea59906ed5b5b3b9471e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 16 Apr 2013 10:35:14 +0200 Subject: [PATCH 05/10] Update translation files --- po/de.po | 14 +++++++------- po/pylock.pot | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/po/de.po b/po/de.po index d5a83ba..b012d29 100644 --- a/po/de.po +++ b/po/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: pylock 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-04-12 16:37+0200\n" +"POT-Creation-Date: 2013-04-16 10:35+0200\n" "PO-Revision-Date: 2012-02-01 19:30+0100\n" "Last-Translator: Matthias Schiffer \n" "Language-Team: German \n" @@ -16,11 +16,11 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../pylock/LockWindow.py:119 +#: ../pylock/LockWindow.py:123 msgid "This computer is currently locked by the user {username}." msgstr "Dieser Computer ist zur Zeit vom Benutzer {username} gesperrt." -#: ../pylock/LockWindow.py:123 +#: ../pylock/LockWindow.py:127 msgid "" "This computer is currently locked by the user {username}.\n" "The user can be logged out in {minutes:02}:{seconds:02} minutes." @@ -28,7 +28,7 @@ msgstr "" "Dieser Computer ist zur Zeit vom Benutzer {username} gesperrt.\n" "Der Benutzer kann in {minutes:02}:{seconds:02} Minuten ausgeloggt werden." -#: ../pylock/LockWindow.py:128 +#: ../pylock/LockWindow.py:132 msgid "" "This computer is currently locked by the user {username}.\n" "The user can be logged out now." @@ -36,14 +36,14 @@ msgstr "" "Dieser Computer ist zur Zeit vom Benutzer {username} gesperrt.\n" "Der Benutzer kann jetzt ausgeloggt werden." -#: ../unlock.ui.h:1 +#: ../pylock/data/unlock.ui.h:1 msgid "Password:" msgstr "Passwort:" -#: ../unlock.ui.h:2 +#: ../pylock/data/unlock.ui.h:2 msgid "Unlock" msgstr "Entsperren" -#: ../unlock.ui.h:3 +#: ../pylock/data/unlock.ui.h:3 msgid "Logout" msgstr "Ausloggen" diff --git a/po/pylock.pot b/po/pylock.pot index 1a5dcd9..73397ab 100644 --- a/po/pylock.pot +++ b/po/pylock.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-04-12 18:43+0200\n" +"POT-Creation-Date: 2013-04-16 10:35+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" From b26615eaa13a858ff9b26450af9ce10184555181 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 18 Apr 2013 14:24:04 +0200 Subject: [PATCH 06/10] Add development pylock starter --- pylock.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 pylock.py diff --git a/pylock.py b/pylock.py new file mode 100755 index 0000000..85579bb --- /dev/null +++ b/pylock.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 + +import os +import sys + +sys.path.insert(0, os.path.dirname(__file__)) + +from pylock import Main + +Main.main() From 0164d236e868acaede0e5383fd0bbe6ac4200ac7 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 18 Apr 2013 14:24:28 +0200 Subject: [PATCH 07/10] Fix pylock using 100% CPU when the lock is active --- pylock/Locker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylock/Locker.py b/pylock/Locker.py index 5243609..56cd9e8 100644 --- a/pylock/Locker.py +++ b/pylock/Locker.py @@ -58,7 +58,7 @@ class Locker(object): if self.currentLogoutTimeout > 0: GLib.timeout_add_seconds(1, self._checkLogout) - return True + return False def unlock(self): if self.locked: From 1e64259a0914f41fa5063dd95bc587ae1bd15b5b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 18 Apr 2013 14:24:57 +0200 Subject: [PATCH 08/10] pylock v2 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 3f1c0b4..2ea88e6 100755 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ class install_pylock(distutils.command.install.install): distutils.core.setup( name = 'pylock', - version = '1', + version = '2', author = 'Matthias Schiffer', author_email = 'mschiffer@universe-factory.net', url = 'http://git.universe-factory.net/pylock/', From 232a7fe51a46dca7baeddd4de3167ba80ad2ab03 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 18 Apr 2013 15:26:53 +0200 Subject: [PATCH 09/10] Fix Gtk theme selection --- pylock/Main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylock/Main.py b/pylock/Main.py index 7a2cbb9..d42727b 100644 --- a/pylock/Main.py +++ b/pylock/Main.py @@ -64,7 +64,7 @@ def main(): locale.textdomain('pylock') if 'theme' in config: - Gtk.Settings.get_defalt().set_property('gtk-theme-name', config['theme']) + Gtk.Settings.get_default().set_property('gtk-theme-name', config['theme']) def waitForSelection(): if Selection.get() != 0: From f235a4cdae3c81be9b4c5d54b20416f5cff2c59e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 18 Apr 2013 15:27:54 +0200 Subject: [PATCH 10/10] pylock v3 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2ea88e6..9b4e7d2 100755 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ class install_pylock(distutils.command.install.install): distutils.core.setup( name = 'pylock', - version = '2', + version = '3', author = 'Matthias Schiffer', author_email = 'mschiffer@universe-factory.net', url = 'http://git.universe-factory.net/pylock/',