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/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/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" 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() 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: 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: 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 9034f0e..9b4e7d2 100755 --- a/setup.py +++ b/setup.py @@ -1,29 +1,70 @@ #!/usr/bin/env python3 -import distutils -import DistUtilsExtra.auto +import distutils.core +import distutils.command.build +import distutils.command.install +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.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) -DistUtilsExtra.auto.setup( - name = 'pylock', - version = '1', + distutils.dir_util.copy_tree('etc', os.path.join(self.root, 'etc'), + preserve_times=0, preserve_symlinks=1, verbose=1) - data_files = [], +distutils.core.setup( + name = 'pylock', + version = '3', + 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 = { 'pylock': ['data/unlock.ui', 'data/bg.svg'], }, + scripts = ['scripts/pylock'], + cmdclass = { + 'build': build_pylock, 'install': install_pylock, }, + + provides = ['pylock'], + requires = [ + 'gi.repository.Gtk', + 'gi.repository.Gdk', + 'gi.repository.GdkX11', + 'gi.repository.GObject', + 'gi.repository.GLib', + ], )