Compare commits

...

7 Commits

6 changed files with 29 additions and 30 deletions

View File

@ -1,3 +1,8 @@
gcp 0.2.1 (2019-03-10, Matteo Cypriani):
- fix deprecation warnings with dbus.glib
see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923677
- minor documentation (README) improvements
gcp 0.2.0 (2018-10-14, Matteo Cypriani): gcp 0.2.0 (2018-10-14, Matteo Cypriani):
- actually switch to Python3 - actually switch to Python3
- cp compatibibility: - cp compatibibility:

View File

@ -16,8 +16,8 @@ gcp is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details. PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with You should have received a [copy of the GNU General Public License](LICENSE)
gcp. If not, see <http://www.gnu.org/licenses/>. along with gcp. If not, see <http://www.gnu.org/licenses/>.
About About
@ -39,7 +39,7 @@ functionalities such as:
- **Files saving**: you can keep track of the files you have copied, and copy - **Files saving**: you can keep track of the files you have copied, and copy
them again later (useful when, for example, you copy some free music to your them again later (useful when, for example, you copy some free music to your
friends on a regular basis). friends on a regular basis).
- gcp will be **approximately option-compatible with cp** (approximately - gcp will be **approximately option-compatible with (GNU) cp** (approximately
because the behaviour is not exactly the same, see below). because the behaviour is not exactly the same, see below).
**WARNING**: gcp is at a relatively early stage of development, use at your own **WARNING**: gcp is at a relatively early stage of development, use at your own
@ -72,13 +72,14 @@ On Debian-based systems
How to use it? How to use it?
============== ==============
Pretty much like cp (see `gcp --help`). Pretty much like cp (see `gcp --help` and `man gcp`).
Please note that the behaviour is not exactly the same as cp's, even if gcp Please note that the behaviour is not exactly the same as cp's, even if gcp
aims to be option-compatible. Mainly, the destination filenames can be modified aims to be option-compatible. Mainly, the destination filenames can be modified
(cf. the `--fs-fix` option). (cf. the `--fix-filenames` option).
gcp doesn't implement all the options from cp yet, but it's a long-term goal. gcp doesn't implement all the options GNU cp has yet, but it's a long-term
goal.
Logging Logging
@ -150,7 +151,7 @@ Contributors
* Original author: Jérôme Poisson a.k.a. Goffi <goffi@goffi.org> 2010-2011. * Original author: Jérôme Poisson a.k.a. Goffi <goffi@goffi.org> 2010-2011.
* Thomas Preud'homme <robotux@celest.fr> 2011: manpage, stat resolution fix. * Thomas Preud'homme <robotux@celest.fr> 2011: manpage, stat resolution fix.
* Jingbei Li a.k.a. petronny 2016: conversion to Python3. * Jingbei Li a.k.a. petronny 2016: conversion to Python3.
* Matteo Cypriani <mcy@lm7.fr> 2018: `--fs-fix` option, Python3 fixes. * Matteo Cypriani <mcy@lm7.fr> 2018: `--fix-filenames` option, Python3 fixes.
Contact Contact

2
fr.po
View File

@ -8,7 +8,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 0.2.0\n" "Project-Id-Version: 0.2.1\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-09-30 18:05+0800\n" "POT-Creation-Date: 2010-09-30 18:05+0800\n"
"PO-Revision-Date: 2018-10-14 20:56+0200\n" "PO-Revision-Date: 2018-10-14 20:56+0200\n"

33
gcp
View File

@ -5,7 +5,7 @@ gcp: Gcp CoPier
Copyright (c) 2010, 2011 Jérôme Poisson <goffi@goffi.org> Copyright (c) 2010, 2011 Jérôme Poisson <goffi@goffi.org>
(c) 2011 Thomas Preud'homme <robotux@celest.fr> (c) 2011 Thomas Preud'homme <robotux@celest.fr>
(c) 2016 Jingbei Li <i@jingbei.li> (c) 2016 Jingbei Li <i@jingbei.li>
(c) 2018 Matteo Cypriani <mcy@lm7.fr> (c) 2018, 2019 Matteo Cypriani <mcy@lm7.fr>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -36,12 +36,11 @@ logging.basicConfig(level=logging.INFO, format='%(message)s')
gettext.install('gcp', "i18n") gettext.install('gcp', "i18n")
try: try:
from gi.repository import GObject from gi.repository import GLib
#DBus from dbus.mainloop.glib import DBusGMainLoop
import dbus DBusGMainLoop(set_as_default=True)
import dbus.glib
import dbus.service import dbus.service
import dbus.mainloop.glib import dbus
except ImportError as e: except ImportError as e:
error(_("Error during import")) error(_("Error during import"))
error(_("Please check dependecies:"), e) error(_("Please check dependecies:"), e)
@ -57,7 +56,7 @@ except ImportError as e:
NAME = "gcp (Gcp CoPier)" NAME = "gcp (Gcp CoPier)"
NAME_SHORT = "gcp" NAME_SHORT = "gcp"
VERSION = '0.2.0' VERSION = '0.2.1'
ABOUT = NAME_SHORT + " " + VERSION + """ ABOUT = NAME_SHORT + " " + VERSION + """
--- ---
@ -81,7 +80,6 @@ const_JOURNAL_PATH = const_FILES_DIR + "/journal"
const_SAVED_LIST = const_FILES_DIR + "/saved_list" const_SAVED_LIST = const_FILES_DIR + "/saved_list"
class DbusObject(dbus.service.Object): class DbusObject(dbus.service.Object):
def __init__(self, gcp, bus, path): def __init__(self, gcp, bus, path):
@ -116,7 +114,9 @@ class DbusObject(dbus.service.Object):
return (False, _("INTERNAL ERROR: invalid source_dir")) return (False, _("INTERNAL ERROR: invalid source_dir"))
return self._gcp.parseArguments(args, source_dir) return self._gcp.parseArguments(args, source_dir)
class Journal(): class Journal():
def __init__(self, path=const_JOURNAL_PATH): def __init__(self, path=const_JOURNAL_PATH):
self.journal_path = os.path.expanduser(path) self.journal_path = os.path.expanduser(path)
self.journal_fd = open(self.journal_path,'w') #TODO: check and maybe save previous journals self.journal_fd = open(self.journal_path,'w') #TODO: check and maybe save previous journals
@ -183,8 +183,6 @@ class Journal():
info(_("Please check journal: %s") % self.journal_path) info(_("Please check journal: %s") % self.journal_path)
class GCP(): class GCP():
def __init__(self): def __init__(self):
@ -258,7 +256,6 @@ class GCP():
error(_("Can't copy %(path)s: %(exception)s") error(_("Can't copy %(path)s: %(exception)s")
% {'path':path, 'exception':e.strerror}) % {'path':path, 'exception':e.strerror})
def __appendDirToList(self, dirpath, dest_path, options): def __appendDirToList(self, dirpath, dest_path, options):
"""Add recursively directory to the copy list """Add recursively directory to the copy list
@param path: absolute path of dir @param path: absolute path of dir
@ -361,9 +358,9 @@ class GCP():
source_fd.close() source_fd.close()
return True return True
GObject.io_add_watch(source_fd, GObject.IO_IN,self._copyFile, GLib.io_add_watch(source_fd, GLib.IO_IN,self._copyFile,
(dest_fd, options), (dest_fd, options),
priority=GObject.PRIORITY_DEFAULT) priority=GLib.PRIORITY_DEFAULT)
if not self.progress: if not self.progress:
info(_("COPYING %(source)s ==> %(dest)s") info(_("COPYING %(source)s ==> %(dest)s")
% {"source":source_file, "dest":dest_file}) % {"source":source_file, "dest":dest_file})
@ -377,8 +374,6 @@ class GCP():
source_fd.close() source_fd.close()
dest_fd.close() dest_fd.close()
def _copyFile(self, source_fd, condition, data): def _copyFile(self, source_fd, condition, data):
"""Actually copy the file, callback used with io_add_watch """Actually copy the file, callback used with io_add_watch
@param source_fd: file descriptor of the file to copy @param source_fd: file descriptor of the file to copy
@ -520,7 +515,6 @@ class GCP():
if not args: if not args:
exit(0) exit(0)
if options.sources_list or options.sources_full_list: if options.sources_list or options.sources_full_list:
info(_('Saved sources:')) info(_('Saved sources:'))
sources = list(saved_files.keys()) sources = list(saved_files.keys())
@ -723,7 +717,7 @@ class GCP():
self.__checkArgs(options, source_dir, args) self.__checkArgs(options, source_dir, args)
if not self.__launched: if not self.__launched:
self.journal = Journal() self.journal = Journal()
GObject.idle_add(self.__copyNextFile) GLib.idle_add(self.__copyNextFile)
self.__launched = True self.__launched = True
return (True,'') return (True,'')
@ -733,7 +727,7 @@ class GCP():
def go(self): def go(self):
"""Launch main loop""" """Launch main loop"""
self.loop = GObject.MainLoop() self.loop = GLib.MainLoop()
try: try:
self.loop.run() self.loop.run()
except KeyboardInterrupt: except KeyboardInterrupt:
@ -752,4 +746,3 @@ if __name__ == "__main__":
exit(1) exit(1)
if gcp.journal.partial: if gcp.journal.partial:
exit(2) exit(2)

View File

@ -5,7 +5,7 @@
#, fuzzy #, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 0.2.0\n" "Project-Id-Version: 0.2.1\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-10-14 20:51+0200\n" "POT-Creation-Date: 2018-10-14 20:51+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"

View File

@ -6,7 +6,7 @@ name = 'gcp'
setuptools.setup( setuptools.setup(
name=name, name=name,
version='0.2.0', version='0.2.1',
url='https://code.lm7.fr/mcy/gcp', url='https://code.lm7.fr/mcy/gcp',
license='GPL-3+', license='GPL-3+',