From 1ab3ffd86676e573594b2ba02673aa8686138be2 Mon Sep 17 00:00:00 2001 From: Kwpolska Date: Mon, 13 Aug 2012 20:51:47 +0200 Subject: [PATCH] v0.2.1: terrible bug. Signed-off-by: Kwpolska --- PKGBUILD | 4 ++-- README | 2 +- README.rst | 2 +- TODO.rst | 4 +--- docs/LICENSE.rst | 2 +- docs/README.rst | 2 +- docs/conf.py | 4 ++-- docs/functions.rst | 2 +- docs/trashman.8.gz | Bin 868 -> 868 bytes docs/trashman.rst | 2 +- release | 43 ++++++++++++++++++++++++++++++++++++++++ setup.py | 7 ++++--- trashman.py | 48 +++++++++++++++++++++++++++------------------ 13 files changed, 87 insertions(+), 35 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 89fcd61..f214726 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Kwpolska pkgname=trashman -pkgver=0.2.0 +pkgver=0.2.1 pkgrel=1 pkgdesc='A Python XDG trash manager. (built under py3k)' arch=('any') @@ -9,7 +9,7 @@ license=('BSD') depends=('python') options=(!emptydirs) source=("http://pypi.python.org/packages/source/t/${pkgname}/${pkgname}-${pkgver}.tar.gz") -md5sums=('acb9613c9db9585ca88c5efbd5706207') +md5sums=('a37099d36ae0dcecfaf920e505c73cf7') package() { cd "${srcdir}/${pkgname}-${pkgver}" diff --git a/README b/README index 7f8f906..7771363 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ Trashman. A Python XDG trash manager. :Info: This is the README file for Trashman. :Author: Kwpolska :Date: 2012-08-13 -:Version: 0.2.0 +:Version: 0.2.1 PURPOSE ------- diff --git a/README.rst b/README.rst index 7f8f906..7771363 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ Trashman. A Python XDG trash manager. :Info: This is the README file for Trashman. :Author: Kwpolska :Date: 2012-08-13 -:Version: 0.2.0 +:Version: 0.2.1 PURPOSE ------- diff --git a/TODO.rst b/TODO.rst index d845802..de5ac96 100644 --- a/TODO.rst +++ b/TODO.rst @@ -17,10 +17,8 @@ TODO for Trashman: (created a directory called ~/Desktop/TRASHTEST, added a file, trashed the directory, tried to restore the file inside) - * manpage - requires: .rst, ./release modifications (stel from pkgbuilder) - * [proposition] file management UI requires: magic, qt/ncurses (ranger is in python, this might be of use) + NOTE: don’t forget that ncurses = pure evil! -- Kwpolska 2012-08-10T18:53:00Z diff --git a/docs/LICENSE.rst b/docs/LICENSE.rst index bd02ca8..9ff1a32 100644 --- a/docs/LICENSE.rst +++ b/docs/LICENSE.rst @@ -4,7 +4,7 @@ Appendix A. License for Trashman :Info: This is an appendix to the Trashman documentation. :Author: Kwpolska :Date: 2012-08-13 -:Version: 0.2.0 +:Version: 0.2.1 .. index:: LICENSE diff --git a/docs/README.rst b/docs/README.rst index 7f8f906..7771363 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -5,7 +5,7 @@ Trashman. A Python XDG trash manager. :Info: This is the README file for Trashman. :Author: Kwpolska :Date: 2012-08-13 -:Version: 0.2.0 +:Version: 0.2.1 PURPOSE ------- diff --git a/docs/conf.py b/docs/conf.py index 28e07fb..e68c13c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -49,9 +49,9 @@ # built documents. # # The short X.Y version. -version = '0.2.0' +version = '0.2.1' # The full version, including alpha/beta/rc tags. -release = '0.2.0' +release = '0.2.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/docs/functions.rst b/docs/functions.rst index 8c93653..372b2ac 100644 --- a/docs/functions.rst +++ b/docs/functions.rst @@ -4,7 +4,7 @@ Functions List :Author: Kwpolska :Copyright: See Appendix A. :Date: 2012-08-13 -:Version: 0.2.0 +:Version: 0.2.1 .. index:: functions diff --git a/docs/trashman.8.gz b/docs/trashman.8.gz index 230a47e2840495d8220063d93f40c3c1ae81b911..a671e4b95895430a20b143d1dd9e59a376da7b65 100644 GIT binary patch delta 29 lcmaFD_Joa1zMF$%jn7234o2^d{b!jtly6;B-^b3t005VX3CREe delta 29 lcmaFD_Joa1zMF&Nq~b)j4o2sV{b!jt3}V~o?_+0R005K432^`b diff --git a/docs/trashman.rst b/docs/trashman.rst index 76afe74..a74af83 100644 --- a/docs/trashman.rst +++ b/docs/trashman.rst @@ -5,7 +5,7 @@ Trashman :Author: Kwpolska :Copyright: See Appendix A. :Date: 2012-08-13 -:Version: 0.2.0 +:Version: 0.2.1 :Manual section: 1 :Manual group: Trashman manual diff --git a/release b/release index be67658..312213a 100755 --- a/release +++ b/release @@ -30,6 +30,49 @@ rm docs/trashman.8.gz | true rst2man docs/trashman.rst > docs/trashman.8 gzip docs/trashman.8 +xgettext -c trashman.py -o ./messages.pot + +sed '1,+17d' ./messages.pot > ./messages.pot.tmp + +pot='# Trashman pot file. +# Copyright (C) 2011-2012, Kwpolska. +# This file is distributed under the same license as the Trashman package. +# Kwpolska , 2011-2012. +# +msgid "" +msgstr "" +"Project-Id-Version: #version\\n" +"Report-Msgid-Bugs-To: Kwpolska \\n" +"POT-Creation-Date: #datel\\n" +"PO-Revision-Date: #datel\\n" +"Last-Translator: Kwpolska \\n" +"Language-Team: Kwpolska \\n" +"Language: en\\n" +"MIME-Version: 1.0\\n" +"Content-Type: text/plain; charset=UTF-8\\n" +"Content-Transfer-Encoding: 8bit\\n"' + +echo $pot > messages.pot +cat ./messages.pot.tmp >> messages.pot +rm ./messages.pot.tmp + +sed "s/#version/$version/g" messages.pot -i +sed "s/#datel/$datel/g" messages.pot -i + +for i in ./locale/*; do + language=$(basename $i) + + podir="./locale/$language/LC_MESSAGES" + popath="./locale/$language/LC_MESSAGES/trashman.po" + sed 's/\"Project-Id-Version: .*/\"Project-Id-Version: '$version'\\n\"/' $popath -i + msgmerge $popath messages.pot -o $popath + fuzzy=$(cat $popath | grep '#, fuzzy') + echo "Please press a key to validate language $language." + read validatesure + $EDITOR $popath + msgfmt -o $podir/trashman.mo $popath +done + python -c 'import trashman' if [[ $? = 1 ]]; then echo "Import failed. Fix your code or don't come back." diff --git a/setup.py b/setup.py index 59a35e9..b628e33 100755 --- a/setup.py +++ b/setup.py @@ -4,10 +4,9 @@ from setuptools import setup except ImportError: from distutils.core import setup -#from distutils.core import setup setup(name='trashman', - version='0.2.0', + version='0.2.1', description='A Python XDG trash manager.', author='Kwpolska', author_email='kwpolska@kwpolska.tk', @@ -25,4 +24,6 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 3', 'Topic :: Utilities'], - scripts=['bin/trash']) + py_modules = ['trashman'], + scripts=['bin/trash'], + data_files=[('share/man/man8', ['docs/pkgbuilder.8.gz'])]) diff --git a/trashman.py b/trashman.py index 3c72ea9..3b5e5c7 100755 --- a/trashman.py +++ b/trashman.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- encoding: utf-8 -*- -# Trashman v0.2.0 +# Trashman v0.2.1 +# A Python XDG trash manager. # Copyright (C) 2011-2012, Kwpolska. # All rights reserved. # @@ -34,7 +35,11 @@ """ trashman ~~~~~~~~ - A Python XDG Trash manager. + + A Python XDG trash manager. + + :Copyright: (C) 2011-2012, Kwpolska. + :License: BSD (see /LICENSE). """ import shutil @@ -44,6 +49,7 @@ import datetime import sys import argparse +import gettext try: import configparser @@ -55,8 +61,11 @@ else: trash = os.getenv('XDG_DATA_HOME') + '/Trash' +T = gettext.translation('trashman', '/usr/share/locale', fallback='C') +_ = T.gettext + __title__ = 'Trashman' -__version__ = '0.2.0' +__version__ = '0.2.1' __author__ = 'Kwpolska' __license__ = '3-clause BSD' @@ -104,7 +113,7 @@ def empty_trash(verbose): shutil.rmtree(trash + '/info') regenerate_trash() if verbose: - sys.stderr.write("emptied the trash\n") + sys.stderr.write(_("emptied the trash\n")) def list_files(): @@ -144,7 +153,7 @@ def move_to_trash(filepath, verbose): regenerate_trash() if verbose: - sys.stderr.write("trashed ‘{0}’\n".format(filename)) + sys.stderr.write(_("trashed ‘{0}’\n").format(filename)) def restore_from_trash(filename, verbose): @@ -156,40 +165,41 @@ def restore_from_trash(filename, verbose): os.remove(trash + '/info/' + filename + '.trashinfo') regenerate_trash() if verbose: - sys.stderr.write('restored {0} to {1} (trashed {2})\n'.format( - filename, info['Path'], info['DeletionDate'])) + sys.stderr.write(_('restored {0} to {1} (trashed {2})\n'.format( + filename, info['Path'], info['DeletionDate']))) else: raise Exception('no such file in trash') def main(): """The main routine.""" - parser = argparse.ArgumentParser(description="Trashman – a Python XDG \ - trash manager.") + parser = argparse.ArgumentParser(description=_("Trashman – a Python \ + XDG trash manager.")) parser.add_argument('-V', '--version', action='version', version='Trashman v' + __version__) parser.add_argument('-v', '--verbose', action='store_true', default=False, - dest='verbose', help="explain what is being done") + dest='verbose', help=_("explain what is being done")) parser.add_argument('-e', '--empty', action='store_true', default=False, - dest='empty', help="empty the trash and quit") + dest='empty', help=_("empty the trash and quit")) parser.add_argument('-l', '--list', action='store_true', default=False, - dest='flist', help="list the files in trash and quit") + dest='flist', help=_("list the files in trash and \ + quit")) parser.add_argument('-r', '--restore', action='store_true', default=False, - dest='restore', help="restore FILE(s) from trash") + dest='restore', help=_("restore FILE(s) from trash")) parser.add_argument('-w', '--trash-location', action='store_true', - default=False, dest='showloc', help="print the \ - trash location and quit") - parser.add_argument('files', metavar="FILE", action='store', nargs='*', - help="files to remove") + default=False, dest='showloc', help=_("print the \ + trash location and quit")) + parser.add_argument('files', metavar=_("FILE"), action='store', nargs='*', + help=_("files to remove")) args = parser.parse_args() quit_notrash = False if not os.path.exists(trash): if args.verbose: - sys.stderr.write("“{0}” does not exist, creating...".format( - trash)) + sys.stderr.write(_("“{0}” does not exist, \ +creating...").format(trash)) regenerate_trash()