Этот коммит содержится в:
Matteo Cypriani 2018-04-15 11:49:29 +02:00
родитель 8d60858375
Коммит 67469febfb
4 изменённых файлов: 27 добавлений и 27 удалений

Просмотреть файл

@ -1,7 +1,7 @@
gcp 0.1.3 (20/06/11):
- fixed exit status
- updated manpage with exit status
- gcp DIR1 DIR2 syntax fixed
- gcp DIR1 DIR2 syntax fixed
- tests
gcp 0.1.2 (16/06/11):
- removed bad fd close
@ -10,12 +10,12 @@ gcp 0.1.2 (16/06/11):
- unaccessible source dir crash fix
- os.stat precision fix
- manpage
- install script
- install script
gcp 0.1.1 (30/09/10):
- double entry check in journal
- unicode source_path send via dbus (second instance of gcp) fixed
- errors are now shown after copy
- fixed bad closure when a file already exists
- added "gcp SOURCE_FILE DEST_FILE" syntax management
- added "gcp SOURCE_FILE DEST_FILE" syntax management
gcp 0.1 (28/09/10):
**INITIAL PUBLIC RELEASE**

2
README
Просмотреть файл

@ -35,7 +35,7 @@ gcp is a file copier, loosely inspired from cp, but with high level functionalit
gcp is at an early stage of development, and really experimental: use at your own risks !
** How to use it ? **
Pretty much like cp (see gcp --help).
Pretty much like cp (see gcp --help).
Please note that the behaviour is not exactly the same as cp, even if gcp want to be option-compatible. Mainly, the destination filenames can be changed (by default, can be deactivated).
gcp doesn't implement yet all the options from cp, but it's planed.

38
gcp
Просмотреть файл

@ -69,7 +69,7 @@ This software is an advanced file copier
Get the latest version at http://wiki.goffi.org/wiki/Gcp
""")
const_DBUS_INTERFACE = "org.goffi.gcp"
const_DBUS_INTERFACE = "org.goffi.gcp"
const_DBUS_PATH = "/org/goffi/gcp"
const_BUFF_SIZE = 4096
const_PRESERVE = set(['mode','ownership','timestamps'])
@ -86,7 +86,7 @@ class DbusObject(dbus.service.Object):
dbus.service.Object.__init__(self, bus, path)
debug(_("Init DbusObject..."))
self.cb={}
@dbus.service.method(const_DBUS_INTERFACE,
in_signature='', out_signature='s')
def getVersion(self):
@ -294,7 +294,7 @@ class GCP():
dest_path = os.path.normpath(os.path.join(source_dir, args.pop()))
except OSError,e:
error (_("Invalid dest_path: %s"),e)
for path in args:
abspath = os.path.normpath(os.path.join(os.path.expanduser(source_dir), path))
if not os.path.exists(abspath):
@ -312,7 +312,7 @@ class GCP():
def __copyNextFile(self):
"""Take the last file in the list, and launch the copy using glib io_watch event
@return: True a file was added, False else"""
@return: True a file was added, False else"""
if self.copy_list:
source_file, dest_path, options = self.copy_list.pop()
self.journal.startFile(source_file)
@ -341,7 +341,7 @@ class GCP():
self.journal.closeFile()
source_fd.close()
return True
gobject.io_add_watch(source_fd,gobject.IO_IN,self._copyFile,
(dest_fd, options), priority=gobject.PRIORITY_DEFAULT)
if not self.progress:
@ -362,7 +362,7 @@ class GCP():
self.journal.closeFile()
source_fd.close()
dest_fd.close()
def _copyFile(self, source_fd, condition, data):
@ -520,7 +520,7 @@ class GCP():
if options.sources_save or options.sources_replace:
if saved_files.has_key(options.sources_save) and not options.sources_replace:
error(_("There is already a saved sources with this name, skipping --sources-save"))
error(_("There is already a saved sources with this name, skipping --sources-save"))
else:
if len(args)>1:
saved_files[options.sources_save] = map(os.path.abspath,args[:-1])
@ -552,24 +552,24 @@ class GCP():
if isinstance(full_args[idx], unicode):
#We don't want unicode as some filenames can be invalid unicode
full_args[idx] = full_args[idx].encode('utf-8')
parser = OptionParser(usage=_usage,version=ABOUT)
parser.add_option("-r", "--recursive", action="store_true", default=False,
help=_("copy directories recursively"))
parser.add_option("-f", "--force", action="store_true", default=False,
help=_("force overwriting of existing files"))
parser.add_option("--preserve", action="store", default='mode,ownership,timestamps',
help=_("preserve the specified attributes"))
parser.add_option("-L", "--dereference", action="store_true", default=False,
help=_("always follow symbolic links in sources"))
parser.add_option("-P", "--no-dereference", action="store_false", dest='dereference',
help=_("never follow symbolic links in sources"))
#parser.add_option("--no-unicode-fix", action="store_false", dest='unicode_fix', default=True,
# help=_("don't fix name encoding errors")) #TODO
@ -578,12 +578,12 @@ class GCP():
parser.add_option("--no-progress", action="store_false", dest="progress", default=True,
help=_("deactivate progress bar"))
parser.add_option("-v", "--verbose", action="store_true", default=False,
help=_("Show what is currently done"))
group_saving = OptionGroup(parser, "sources saving")
group_saving.add_option("--sources-save", action="store",
help=_("Save source arguments"))
@ -592,19 +592,19 @@ class GCP():
group_saving.add_option("--sources-load", action="store",
help=_("Load source arguments"))
group_saving.add_option("--sources-del", action="store",
help=_("delete saved sources"))
group_saving.add_option("--sources-list", action="store_true", default=False,
help=_("List names of saved sources"))
group_saving.add_option("--sources-full-list", action="store_true", default=False,
help=_("List names of saved sources and files in it"))
parser.add_option_group(group_saving)
(options, args) = parser.parse_args(full_args)
options.directdir = False #True only in the special case: we are copying a dir and it doesn't exists
#options check
@ -642,7 +642,7 @@ class GCP():
options.dest_file = None
else:
options.dest_file = None
#if there is an other instance of gcp, we send options to it
if not self._main_instance:
info (_("There is already one instance of %s running, pluging to it") % NAME_SHORT)

Просмотреть файл

@ -59,8 +59,8 @@ def dirCheck(dir_path):
if isdir(full_path):
recursive_sum(full_path, result)
else:
result[full_path] = sha1sum(full_path)
result[full_path] = sha1sum(full_path)
result = {}
_ori_dir = getcwd()
chdir(dir_path)
@ -94,7 +94,7 @@ def makeRandomFile(path, size=S10K, buf_size=4096):
def makeTestDir(path):
"""Helper method to easily create a test dir
@param path: where the dir must be created"""
for i in range(2):
subdir = join(path,'subdir_%d' % i)
makedirs(subdir)
@ -198,7 +198,7 @@ class TestCopyCases(unittest.TestCase):
self.assertEqual(ret,0)
check_2 = dirCheck('dest_dir')
self.assertEqual(check_1, check_2)
def test_mixt_copy_existing_dest_nonrecursive(self):
"""Check that a mixt copy (files + dir) to an existing dest without the recursive option work as expected"""
for i in range(2):