Compare commits
16 Commits
4c02959204
...
b2dcbd8368
Author | SHA1 | Date |
---|---|---|
Matteo Cypriani | b2dcbd8368 | |
Matteo Cypriani | c86dae222a | |
Matteo Cypriani | f99dcc1e2c | |
Matteo Cypriani | cbd96480c5 | |
Matteo Cypriani | c4db1808da | |
Matteo Cypriani | e17dbfa1c8 | |
Matteo Cypriani | b83d37a5e9 | |
Matteo Cypriani | 2e0e8ba994 | |
Matteo Cypriani | d40548f287 | |
Matteo Cypriani | 193a0e2784 | |
Matteo Cypriani | 307ffbea86 | |
Matteo Cypriani | 2136a91df4 | |
Matteo Cypriani | 1de548e62f | |
Matteo Cypriani | e008689b9b | |
Matteo Cypriani | 97f8f0d752 | |
Matteo Cypriani | f436127427 |
56
CHANGELOG
56
CHANGELOG
|
@ -1,21 +1,35 @@
|
||||||
gcp 0.1.3 (20/06/11):
|
gcp 0.2.0 (UNRELEASED, Matteo Cypriani):
|
||||||
- fixed exit status
|
- actually switch to Python3
|
||||||
- updated manpage with exit status
|
- cp compatibibility:
|
||||||
- gcp DIR1 DIR2 syntax fixed
|
+ don't preserve any attributes by default (Jingbei Li)
|
||||||
- tests
|
+ added -p switch (same as --preserve=mode,ownership,timestamps)
|
||||||
gcp 0.1.2 (16/06/11):
|
+ added -R switch (same as --recursive)
|
||||||
- removed bad fd close
|
- new --fs-fix option
|
||||||
- crash fix when source file can't be openned
|
|
||||||
- symbolic link skipping (--dereferrence and --no-dereferrence options)
|
gcp 0.1.4.dev1 (unreleased, Jingbei Li):
|
||||||
- unaccessible source dir crash fix
|
- main Python3 migration work
|
||||||
- os.stat precision fix
|
|
||||||
- manpage
|
gcp 0.1.3 (2011-06-20, Goffi):
|
||||||
- install script
|
- fixed exit status
|
||||||
gcp 0.1.1 (30/09/10):
|
- updated manpage with exit status
|
||||||
- double entry check in journal
|
- gcp DIR1 DIR2 syntax fixed
|
||||||
- unicode source_path send via dbus (second instance of gcp) fixed
|
- tests
|
||||||
- errors are now shown after copy
|
|
||||||
- fixed bad closure when a file already exists
|
gcp 0.1.2 (2011-06-16, Goffi):
|
||||||
- added "gcp SOURCE_FILE DEST_FILE" syntax management
|
- removed bad fd close
|
||||||
gcp 0.1 (28/09/10):
|
- crash fix when source file can't be openned
|
||||||
**INITIAL PUBLIC RELEASE**
|
- symbolic link skipping (--dereferrence and --no-dereferrence options)
|
||||||
|
- unaccessible source dir crash fix
|
||||||
|
- os.stat precision fix
|
||||||
|
- manpage
|
||||||
|
- install script
|
||||||
|
|
||||||
|
gcp 0.1.1 (2010-09-30, Goffi):
|
||||||
|
- 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
|
||||||
|
|
||||||
|
gcp 0.1 (2010-09-28, Goffi):
|
||||||
|
- **INITIAL PUBLIC RELEASE**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include MANIFEST.in distribute_setup.py gcp.1
|
include MANIFEST.in gcp.1
|
||||||
global-include *.py
|
global-include *.py
|
||||||
global-include *.po *.mo
|
global-include *.po *.mo
|
||||||
global-include CHANGELOG COPYING* INSTALL README*
|
global-include CHANGELOG COPYING* README*
|
||||||
global-exclude *.un~ *.swp
|
global-exclude *.un~ *.swp
|
||||||
|
|
21
README.md
21
README.md
|
@ -45,6 +45,27 @@ functionalities such as:
|
||||||
risks!
|
risks!
|
||||||
|
|
||||||
|
|
||||||
|
Installing
|
||||||
|
==========
|
||||||
|
|
||||||
|
The Python way
|
||||||
|
--------------
|
||||||
|
|
||||||
|
pip3 install gcp
|
||||||
|
|
||||||
|
Note that you should have the following packages installed so that pip can
|
||||||
|
complete the installation (Debian packages names, but you get the idea):
|
||||||
|
- libdbus-1-dev
|
||||||
|
- libdbus-glib-1-dev
|
||||||
|
- libgirepository1.0-dev
|
||||||
|
- libcairo2-dev
|
||||||
|
|
||||||
|
On Debian-based systems
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
apt install gcp
|
||||||
|
|
||||||
|
|
||||||
How to use it?
|
How to use it?
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
|
267
fr.po
267
fr.po
|
@ -1,38 +1,36 @@
|
||||||
# Goffi's CoPier.
|
# gcp -- French translation file
|
||||||
# Copyright (C) 2010 Jérôme Poisson
|
# Copyright:
|
||||||
|
# 2010 Jérôme Poisson (Goffi) <goffi@goffi.org>
|
||||||
|
# 2018 Matteo Cypriani <mcy@lm7.fr>
|
||||||
# This file is distributed under the same license as the gcp package.
|
# This file is distributed under the same license as the gcp package.
|
||||||
# Jérôme Poisson (Goffi) <goffi@goffi.org>, 2010.
|
|
||||||
# Goffi <goffi@goffi.org>, 2010.
|
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: 0.1\n"
|
"Project-Id-Version: 0.2.0\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: 2010-09-30 18:09+0800\n"
|
"PO-Revision-Date: 2018-04-22 20:35+0200\n"
|
||||||
"Last-Translator: Goffi <goffi@goffi.org>\n"
|
"Last-Translator: Matteo Cypriani <mcy@lm7.fr>\n"
|
||||||
"Language-Team: French <goffi@goffi.org>\n"
|
"Language: French\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: gcp:43
|
#: gcp:45
|
||||||
msgid "Error during import"
|
msgid "Error during import"
|
||||||
msgstr "Erreur pendant l'import de bibliothèques"
|
msgstr "Erreur pendant l'import de bibliothèques"
|
||||||
|
|
||||||
#: gcp:44
|
#: gcp:46
|
||||||
msgid "Please check dependecies:"
|
msgid "Please check dependecies:"
|
||||||
msgstr "Merci de vérifier les dépendances"
|
msgstr "Merci de vérifier les dépendances :"
|
||||||
|
|
||||||
#: gcp:50
|
#: gcp:52
|
||||||
msgid ""
|
msgid "ProgressBar not available, please download it at https://pypi.org/"
|
||||||
"ProgressBar not available, please download it at http://pypi.python.org/pypi/"
|
|
||||||
"progressbar"
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"«ProgressBar» n'est pas disponible, merci de le télécharger à http://pypi."
|
"ProgressBar n'est pas disponible, merci de le télécharger depuis"
|
||||||
"python.org/pypi/progressbar"
|
"https://pypi.org/"
|
||||||
|
|
||||||
#: gcp:51
|
#: gcp:3
|
||||||
msgid ""
|
msgid ""
|
||||||
"Progress bar deactivated\n"
|
"Progress bar deactivated\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
@ -40,235 +38,240 @@ msgstr ""
|
||||||
"Barre de progression désactivée\n"
|
"Barre de progression désactivée\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
|
|
||||||
#: gcp:62
|
#: gcp:88
|
||||||
msgid ""
|
|
||||||
"This program comes with ABSOLUTELY NO WARRANTY;\n"
|
|
||||||
"This is free software, and you are welcome to redistribute it\n"
|
|
||||||
"under certain conditions.\n"
|
|
||||||
"---\n"
|
|
||||||
"\n"
|
|
||||||
"This software is an advanced file copier\n"
|
|
||||||
"Get the latest version at http://www.goffi.org\n"
|
|
||||||
msgstr ""
|
|
||||||
"This program comes with ABSOLUTELY NO WARRANTY;\n"
|
|
||||||
"This is free software, and you are welcome to redistribute it\n"
|
|
||||||
"under certain conditions.\n"
|
|
||||||
"---\n"
|
|
||||||
"\n"
|
|
||||||
"Ce logiciel est un copieur de fichiers avancé\n"
|
|
||||||
"Vous pouvez télécharger la dernière version à http://www.goffi.org\n"
|
|
||||||
|
|
||||||
#: gcp:86
|
|
||||||
msgid "Init DbusObject..."
|
msgid "Init DbusObject..."
|
||||||
msgstr "Initialisation de «DbusObject»"
|
msgstr "Initialisation de «DbusObject»"
|
||||||
|
|
||||||
#: gcp:106
|
#: gcp:109
|
||||||
msgid "INTERNAL ERROR: invalid arguments"
|
msgid "INTERNAL ERROR: invalid arguments"
|
||||||
msgstr "ERREUR INTERNE: arguments invalides"
|
msgstr "ERREUR INTERNE : arguments invalides"
|
||||||
|
|
||||||
#: gcp:110
|
#: gcp:114
|
||||||
msgid "INTERNAL ERROR: invalid source_path"
|
msgid "INTERNAL ERROR: invalid source_dir"
|
||||||
msgstr "ERREUR INTERNE:.chemin source invalide"
|
msgstr "ERREUR INTERNE : chemin source invalide"
|
||||||
|
|
||||||
#: gcp:165
|
#: gcp:169
|
||||||
msgid "/!\\ THE FOLLOWING FILES WERE *NOT* SUCCESSFULY COPIED:"
|
msgid "/!\\ THE FOLLOWING FILES WERE *NOT* SUCCESSFULY COPIED:"
|
||||||
msgstr "/!\\ LES FICHIERS SUIVANTS *N'ONT PAS* ÉTÉ COPIÉS:"
|
msgstr "/!\\ LES FICHIERS SUIVANTS N'ONT *PAS* ÉTÉ COPIÉS :"
|
||||||
|
|
||||||
#: gcp:171
|
#: gcp:175
|
||||||
msgid "The following files were copied, but some errors happened:"
|
msgid "The following files were copied, but some errors happened:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Les fichiers suivant ont été copiés, mais quelques erreurs sont survenues:"
|
"Les fichiers suivant ont été copiés, mais quelques erreurs sont survenues :"
|
||||||
|
|
||||||
#: gcp:177
|
#: gcp:181
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Please check journal: %s"
|
msgid "Please check journal: %s"
|
||||||
msgstr "Merci de vérifier le journal: %s"
|
msgstr "Merci de vérifier le journal : %s"
|
||||||
|
|
||||||
#: gcp:199
|
#: gcp:203
|
||||||
msgid "gcp launched"
|
msgid "gcp launched"
|
||||||
msgstr "gcp lancé"
|
msgstr "gcp lancé"
|
||||||
|
|
||||||
#: gcp:207
|
#: gcp:211
|
||||||
msgid "Init DBus..."
|
msgid "Init DBus..."
|
||||||
msgstr "Initialisation de Dbus..."
|
msgstr "Initialisation de Dbus..."
|
||||||
|
|
||||||
#: gcp:237
|
#: gcp:241
|
||||||
msgid "Can't read mounts table"
|
msgid "Can't read mounts table"
|
||||||
msgstr "Impossible de lire la table des montages"
|
msgstr "Impossible de lire la table des montages"
|
||||||
|
|
||||||
#: gcp:244
|
#: gcp:248
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Adding to copy list: %(path)s ==> %(dest_path)s (%(fs_type)s)"
|
msgid "Adding to copy list: %(path)s ==> %(dest_path)s (%(fs_type)s)"
|
||||||
msgstr "Ajout à la liste des copies: %(path)s ==> %(dest_path)s (%(fs_type)s)"
|
msgstr "Ajout à la liste des copies : %(path)s ==> %(dest_path)s (%(fs_type)s)"
|
||||||
|
|
||||||
#: gcp:251
|
#: gcp:253
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Can't copy %(path)s: %(exception)s"
|
msgid "Can't copy %(path)s: %(exception)s"
|
||||||
msgstr "Impossible de copier %(path)s: %(exception)s"
|
msgstr "Impossible de copier %(path)s : %(exception)s"
|
||||||
|
|
||||||
#: gcp:274
|
#: gcp:280
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Can't append %(path)s to copy list: %(exception)s"
|
msgid "Can't append %(path)s to copy list: %(exception)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Impossible d'ajouter %(path)s à la liste des fichiers à copier: %(exception)s"
|
"Impossible d'ajouter %(path)s à la liste des fichiers à copier : %(exception)s"
|
||||||
|
|
||||||
#: gcp:283
|
#: gcp:283
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Invalid dest_path: %s"
|
msgid "Can't access %(dirpath)s: %(exception)s"
|
||||||
msgstr "Chemin de destination invalide: %s"
|
msgstr "Impossible d'accéder à %(dirpath)s : %(exception)s"
|
||||||
|
|
||||||
#: gcp:288
|
#: gcp:295
|
||||||
|
#, python-format
|
||||||
|
msgid "Invalid dest_path: %s"
|
||||||
|
msgstr "Chemin de destination invalide : %s"
|
||||||
|
|
||||||
|
#: gcp:300
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "The path given in arg doesn't exist or is not accessible: %s"
|
msgid "The path given in arg doesn't exist or is not accessible: %s"
|
||||||
msgstr "Le chemin donné en argument n'existe pas ou n'est pas accessible: %s"
|
msgstr "Le chemin donné en argument n'existe pas ou n'est pas accessible : %s"
|
||||||
|
|
||||||
#: gcp:293
|
#: gcp:304
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "omitting directory \"%s\""
|
msgid "omitting directory \"%s\""
|
||||||
msgstr "Répertoire \"%s\" ignoré"
|
msgstr "Répertoire \"%s\" ignoré"
|
||||||
|
|
||||||
#: gcp:310
|
#: gcp:329
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "File [%s] already exists, skipping it !"
|
msgid "File [%s] already exists, skipping it!"
|
||||||
msgstr "Le fichier [%s] existe déjà, je le saute !"
|
msgstr "Le fichier [%s] existe déjà, je le saute !"
|
||||||
|
|
||||||
#: gcp:328
|
#: gcp:347
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "COPYING %(source)s ==> %(dest)s"
|
msgid "COPYING %(source)s ==> %(dest)s"
|
||||||
msgstr "COPIE %(source)s ==> %(dest)s"
|
msgstr "COPIE %(source)s ==> %(dest)s"
|
||||||
|
|
||||||
#: gcp:429
|
#: gcp:447
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "%.2f PiB"
|
msgid "%.2f PiB"
|
||||||
msgstr "%.2f Pio"
|
msgstr "%.2f Pio"
|
||||||
|
|
||||||
#: gcp:431
|
#: gcp:449
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "%.2f TiB"
|
msgid "%.2f TiB"
|
||||||
msgstr "%.2f Tio"
|
msgstr "%.2f Tio"
|
||||||
|
|
||||||
#: gcp:433
|
#: gcp:451
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "%.2f GiB"
|
msgid "%.2f GiB"
|
||||||
msgstr "%.2f Gio"
|
msgstr "%.2f Gio"
|
||||||
|
|
||||||
#: gcp:435
|
#: gcp:453
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "%.2f MiB"
|
msgid "%.2f MiB"
|
||||||
msgstr "%.2f Mio"
|
msgstr "%.2f Mio"
|
||||||
|
|
||||||
#: gcp:437
|
#: gcp:455
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "%.2f KiB"
|
msgid "%.2f KiB"
|
||||||
msgstr "%.2f Kio"
|
msgstr "%.2f Kio"
|
||||||
|
|
||||||
#: gcp:439
|
#: gcp:457
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "%i B"
|
msgid "%i B"
|
||||||
msgstr "%i o"
|
msgstr "%i o"
|
||||||
|
|
||||||
#: gcp:447 gcp:452
|
#: gcp:465 gcp:470
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Copying %s"
|
msgid "Copying %s"
|
||||||
msgstr "Copie de %s"
|
msgstr "Copie de %s"
|
||||||
|
|
||||||
#: gcp:479 gcp:512
|
#: gcp:497 gcp:530
|
||||||
msgid ""
|
msgid ""
|
||||||
"No saved sources with this name, check existing names with --sources-list"
|
"No saved sources with this name, check existing names with --sources-list"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Aucun sauvegarde de fichiers sources avec ce nom, veuillez vérifier les "
|
"Aucune sauvegarde de fichiers sources avec ce nom, veuillez vérifier les "
|
||||||
"lists existantes avec --sources-list"
|
"listes existantes avec --sources-list"
|
||||||
|
|
||||||
#: gcp:489
|
#: gcp:507
|
||||||
msgid "Saved sources:"
|
msgid "Saved sources:"
|
||||||
msgstr "Liste de sources sauvées:"
|
msgstr "Liste de sources sauvées :"
|
||||||
|
|
||||||
#: gcp:503
|
#: gcp:521
|
||||||
msgid ""
|
msgid ""
|
||||||
"There is already a saved sources with this name, skipping --sources-save"
|
"There is already a saved sources with this name, skipping --sources-save"
|
||||||
msgstr "Il y a déjà une liste de sources avec ce nom, --sources-save ignoré"
|
msgstr "Il y a déjà une liste de sources avec ce nom, --sources-save ignoré"
|
||||||
|
|
||||||
#: gcp:539
|
|
||||||
msgid "copy directories recursively"
|
|
||||||
msgstr "copie les répertoire récursivement"
|
|
||||||
|
|
||||||
#: gcp:542
|
|
||||||
msgid "force overwriting of existing files"
|
|
||||||
msgstr "force le remplacement des fichiers déjà existants"
|
|
||||||
|
|
||||||
#: gcp:545
|
|
||||||
msgid "preserve the specified attributes"
|
|
||||||
msgstr "garde les attributs spécifiés"
|
|
||||||
|
|
||||||
#: gcp:551
|
|
||||||
msgid "don't fix filesystem name incompatibily"
|
|
||||||
msgstr ""
|
|
||||||
"Ne corrige pas les incompatibilités des noms pour le système de fichiers"
|
|
||||||
|
|
||||||
#: gcp:554
|
|
||||||
msgid "deactivate progress bar"
|
|
||||||
msgstr "désactive la barre de progression"
|
|
||||||
|
|
||||||
#: gcp:557
|
#: gcp:557
|
||||||
msgid "Show what is currently done"
|
msgid "copy directories recursively"
|
||||||
msgstr "Affiche les opérations effectuées"
|
msgstr "copier les répertoire récursivement"
|
||||||
|
|
||||||
#: gcp:562
|
#: gcp:561
|
||||||
msgid "Save source arguments"
|
msgid "force overwriting of existing files"
|
||||||
msgstr "Sauvegarde la liste des fichiers sources"
|
msgstr "forcer le remplacement des fichiers déjà existants"
|
||||||
|
|
||||||
#: gcp:565
|
#: gcp:565
|
||||||
msgid "Save source arguments and replace memory if it already exists"
|
#, python-format
|
||||||
|
msgid "same as --preserve=%s"
|
||||||
|
msgstr "raccourci pour --preserve=%s"
|
||||||
|
|
||||||
|
#: gcp:569
|
||||||
|
#, python-format
|
||||||
|
msgid ""
|
||||||
|
"preserve specified attributes; accepted values: 'all', or one or more "
|
||||||
|
"amongst %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Sauvegarde la liste des fichiers sources et la remplace si elle existe déjà"
|
"préserver les attributs spécifiés; valeurs acceptées : "
|
||||||
|
"'all' ou un ou plusieurs éléments parmi %s"
|
||||||
#: gcp:568
|
|
||||||
msgid "Load source arguments"
|
|
||||||
msgstr "Réutilise les fichiers sources à copier"
|
|
||||||
|
|
||||||
#: gcp:571
|
|
||||||
msgid "delete saved sources"
|
|
||||||
msgstr "Supprime la liste des fichiers sources"
|
|
||||||
|
|
||||||
#: gcp:574
|
#: gcp:574
|
||||||
msgid "List names of saved sources"
|
msgid "always follow symbolic links in sources"
|
||||||
msgstr "Liste les noms des listes de fichiers sources"
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:577
|
#: gcp:578
|
||||||
|
msgid "never follow symbolic links in sources"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:586
|
||||||
|
msgid "fix filesystem name incompatibily (default: auto)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:590
|
||||||
|
msgid "same as --fs-fix=no (overrides --fs-fix)"
|
||||||
|
msgstr "raccourci pour --fs-fix=no (--fs-fix sera ignoré)"
|
||||||
|
|
||||||
|
#: gcp:594
|
||||||
|
msgid "disable progress bar"
|
||||||
|
msgstr "désactiver la barre de progression"
|
||||||
|
|
||||||
|
#: gcp:598
|
||||||
|
msgid "Show what is currently done"
|
||||||
|
msgstr "afficher les opérations effectuées"
|
||||||
|
|
||||||
|
#: gcp:607
|
||||||
|
msgid "Save source arguments"
|
||||||
|
msgstr "sauvegarder la liste des fichiers source"
|
||||||
|
|
||||||
|
#: gcp:611
|
||||||
|
msgid "Save source arguments and replace memory if it already exists"
|
||||||
|
msgstr ""
|
||||||
|
"sauvegarder la liste des fichiers source et la remplacer si elle existe déjà"
|
||||||
|
|
||||||
|
#: gcp:615
|
||||||
|
msgid "Load source arguments"
|
||||||
|
msgstr "réutiliser les fichiers source à copier"
|
||||||
|
|
||||||
|
#: gcp:619
|
||||||
|
msgid "delete saved sources"
|
||||||
|
msgstr "supprimer la liste des fichiers source"
|
||||||
|
|
||||||
|
#: gcp:623
|
||||||
|
msgid "List names of saved sources"
|
||||||
|
msgstr "afficher les noms des listes de fichiers source"
|
||||||
|
|
||||||
|
#: gcp:627
|
||||||
msgid "List names of saved sources and files in it"
|
msgid "List names of saved sources and files in it"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Liste les noms des listes de fichiers sources, en incluant les fichiers "
|
"afficher les noms des listes de fichiers sources, en incluant les fichiers "
|
||||||
"qu'elles contiennent"
|
"qu'elles contiennent"
|
||||||
|
|
||||||
#: gcp:585
|
#: gcp:639
|
||||||
msgid "Progress bar is not available, deactivating"
|
msgid "Progress bar is not available, deactivating"
|
||||||
msgstr "La barre de progression n'est pas disponible, désactivation"
|
msgstr "La barre de progression n'est pas disponible, désactivation"
|
||||||
|
|
||||||
#: gcp:595
|
#: gcp:663
|
||||||
msgid ""
|
#, python-format
|
||||||
"Invalid --preserve value\n"
|
msgid "Invalid --preserve value '%s'"
|
||||||
"valid values are:"
|
msgstr "Valeur de --preserve invalide « %s »"
|
||||||
msgstr ""
|
|
||||||
"La valeur de «--preserve» est invalide\n"
|
|
||||||
"Les valeurs valides sont:"
|
|
||||||
|
|
||||||
#: gcp:616
|
#: gcp:690
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "There is already one instance of %s running, pluging to it"
|
msgid "There is already one instance of %s running, pluging to it"
|
||||||
msgstr "Il y a déjà une instance de %s lancée, je m'y connecte"
|
msgstr "Il y a déjà une instance de %s lancée, je m'y connecte"
|
||||||
|
|
||||||
#: gcp:622
|
#: gcp:696
|
||||||
msgid "Wrong number of arguments"
|
msgid "Wrong number of arguments"
|
||||||
msgstr "Nombre d'arguments invalide"
|
msgstr "Nombre d'arguments invalide"
|
||||||
|
|
||||||
#: gcp:624
|
#: gcp:698
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "adding args to gcp: %s"
|
msgid "adding args to gcp: %s"
|
||||||
msgstr "ajout des arguments à gcp: %s"
|
msgstr "ajout des arguments à gcp : %s"
|
||||||
|
|
||||||
#: gcp:633
|
#: gcp:707
|
||||||
msgid "User interruption: good bye"
|
msgid "User interruption: good bye"
|
||||||
msgstr "Interruption par l'utilisateur: au revoir"
|
msgstr "Interruption par l'utilisateur : au revoir"
|
||||||
|
|
||||||
#~ msgid "don't fixe name encoding errors"
|
#~ msgid "don't fixe name encoding errors"
|
||||||
#~ msgstr "Ne corrige pas les erreurs dans l'encodage des noms"
|
#~ msgstr "Ne corrige pas les erreurs dans l'encodage des noms"
|
||||||
|
|
356
gcp
356
gcp
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
gcp: Goffi's CoPier
|
gcp: Goffi's 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) 2018 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
|
||||||
|
@ -19,59 +21,60 @@ You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
### logging ###
|
|
||||||
import logging
|
import logging
|
||||||
from logging import debug, info, error, warning
|
from logging import debug, info, error, warning
|
||||||
logging.basicConfig(level=logging.INFO,
|
|
||||||
format='%(message)s')
|
|
||||||
###
|
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
gettext.install('gcp', "i18n")
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os,os.path
|
import os
|
||||||
from argparse import ArgumentParser
|
import os.path
|
||||||
|
from argparse import ArgumentParser, RawDescriptionHelpFormatter
|
||||||
import pickle
|
import pickle
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.INFO, format='%(message)s')
|
||||||
|
gettext.install('gcp', "i18n")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from gi.repository import GObject
|
from gi.repository import GObject
|
||||||
#DBus
|
#DBus
|
||||||
import dbus, dbus.glib
|
import dbus
|
||||||
|
import dbus.glib
|
||||||
import dbus.service
|
import dbus.service
|
||||||
import dbus.mainloop.glib
|
import dbus.mainloop.glib
|
||||||
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)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from progressbar import ProgressBar, Percentage, Bar, ETA, FileTransferSpeed
|
from progressbar import ProgressBar, Percentage, Bar, ETA, FileTransferSpeed
|
||||||
pbar_available=True
|
pbar_available=True
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
info (_('ProgressBar not available, please download it at http://pypi.python.org/pypi/progressbar'))
|
info (_("ProgressBar not available, please download it at https://pypi.org/"))
|
||||||
info (_('Progress bar deactivated\n--\n'))
|
info (_('Progress bar deactivated\n--\n'))
|
||||||
pbar_available=False
|
pbar_available=False
|
||||||
|
|
||||||
NAME = "gcp (Goffi's copier)"
|
NAME = "gcp (Goffi's copier)"
|
||||||
NAME_SHORT = "gcp"
|
NAME_SHORT = "gcp"
|
||||||
VERSION = '0.1.3'
|
VERSION = '0.2.0'
|
||||||
|
|
||||||
ABOUT = NAME+u" v"+VERSION+u""" (c) Jérôme Poisson (aka Goffi) 2010, 2011
|
|
||||||
|
|
||||||
|
ABOUT = NAME_SHORT + " " + VERSION + """
|
||||||
---
|
---
|
||||||
"""+NAME+u""" Copyright (C) 2010 Jérôme Poisson
|
""" + NAME + """
|
||||||
""" + _(u"""This program comes with ABSOLUTELY NO WARRANTY;
|
Copyright: 2010-2011 Jérôme Poisson <goffi@goffi.org>
|
||||||
This is free software, and you are welcome to redistribute it
|
2011 Thomas Preud'homme <robotux@celest.fr>
|
||||||
under certain conditions.
|
2016 Jingbei Li <i@jingbei.li>
|
||||||
---
|
2018 Matteo Cypriani <mcy@lm7.fr>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; it is free software,
|
||||||
This software is an advanced file copier
|
and you are welcome to redistribute it under certain conditions.
|
||||||
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_DBUS_PATH = "/org/goffi/gcp"
|
||||||
const_BUFF_SIZE = 4096
|
const_BUFF_SIZE = 4096
|
||||||
const_PRESERVE = set(['mode','ownership','timestamps'])
|
const_PRESERVE = set(['mode','ownership','timestamps'])
|
||||||
|
const_PRESERVE_p = 'mode,ownership,timestamps'
|
||||||
const_FS_FIX = set(['auto','force','no'])
|
const_FS_FIX = set(['auto','force','no'])
|
||||||
const_FILES_DIR = "~/.gcp"
|
const_FILES_DIR = "~/.gcp"
|
||||||
const_JOURNAL_PATH = const_FILES_DIR + "/journal"
|
const_JOURNAL_PATH = const_FILES_DIR + "/journal"
|
||||||
|
@ -228,14 +231,15 @@ class GCP():
|
||||||
|
|
||||||
def __getMountPoints(self):
|
def __getMountPoints(self):
|
||||||
"""Parse /proc/mounts to get currently mounted devices"""
|
"""Parse /proc/mounts to get currently mounted devices"""
|
||||||
#TODO: reparse when a new device is added/a device is removed
|
# TODO: reparse when a new device is added/a device is removed
|
||||||
#(check freedesktop mounting signals)
|
# (check freedesktop mounting signals)
|
||||||
ret = {}
|
ret = {}
|
||||||
try:
|
try:
|
||||||
with open("/proc/mounts",'r') as mounts:
|
with open("/proc/mounts",'r') as mounts:
|
||||||
for line in mounts.readlines():
|
for line in mounts.readlines():
|
||||||
fs_spec, fs_file, fs_vfstype, fs_mntops, fs_freq, fs_passno = line.split(' ')
|
fs_spec, fs_file, fs_vfstype, \
|
||||||
ret[fs_file] = fs_vfstype
|
fs_mntops, fs_freq, fs_passno = line.split(' ')
|
||||||
|
ret[fs_file] = fs_vfstype
|
||||||
except:
|
except:
|
||||||
error (_("Can't read mounts table"))
|
error (_("Can't read mounts table"))
|
||||||
return ret
|
return ret
|
||||||
|
@ -244,12 +248,15 @@ class GCP():
|
||||||
"""Add a file to the copy list
|
"""Add a file to the copy list
|
||||||
@param path: absolute path of file
|
@param path: absolute path of file
|
||||||
@param options: options as return by optparse"""
|
@param options: options as return by optparse"""
|
||||||
debug (_("Adding to copy list: %(path)s ==> %(dest_path)s (%(fs_type)s)") % {"path":path, "dest_path":dest_path, "fs_type":self.getFsType(dest_path)} )
|
debug(_("Adding to copy list: %(path)s ==> %(dest_path)s (%(fs_type)s)")
|
||||||
|
% {"path":path, "dest_path":dest_path,
|
||||||
|
"fs_type":self.getFsType(dest_path)})
|
||||||
try:
|
try:
|
||||||
self.bytes_total+=os.path.getsize(path)
|
self.bytes_total+=os.path.getsize(path)
|
||||||
self.copy_list.insert(0,(path, dest_path, options))
|
self.copy_list.insert(0,(path, dest_path, options))
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
error(_("Can't copy %(path)s: %(exception)s") % {'path':path, 'exception':e.strerror})
|
error(_("Can't copy %(path)s: %(exception)s")
|
||||||
|
% {'path':path, 'exception':e.strerror})
|
||||||
|
|
||||||
|
|
||||||
def __appendDirToList(self, dirpath, dest_path, options):
|
def __appendDirToList(self, dirpath, dest_path, options):
|
||||||
|
@ -309,49 +316,56 @@ class GCP():
|
||||||
self.__appendToList(abspath, dest_path, options)
|
self.__appendToList(abspath, dest_path, options)
|
||||||
|
|
||||||
def __copyNextFile(self):
|
def __copyNextFile(self):
|
||||||
"""Take the last file in the list, and launch the copy using glib io_watch event
|
"""Takes the last file in the list and launches the copy using glib
|
||||||
@return: True a file was added, False else"""
|
io_watch event."""
|
||||||
if self.copy_list:
|
if not self.copy_list:
|
||||||
source_file, dest_path, options = self.copy_list.pop()
|
# Nothing left to copy, we quit
|
||||||
self.journal.startFile(source_file)
|
|
||||||
try:
|
|
||||||
source_fd = open(source_file, 'rb')
|
|
||||||
except:
|
|
||||||
self.journal.copyFailed()
|
|
||||||
self.journal.error("can't open source")
|
|
||||||
self.journal.closeFile()
|
|
||||||
return True
|
|
||||||
filename = os.path.basename(source_file)
|
|
||||||
assert(filename)
|
|
||||||
dest_file = self.__filename_fix(options.dest_file,options) if options.dest_file else self.__filename_fix(os.path.join(dest_path,filename),options)
|
|
||||||
if os.path.exists(dest_file) and not options.force:
|
|
||||||
warning (_("File [%s] already exists, skipping it !") % dest_file)
|
|
||||||
self.journal.copyFailed()
|
|
||||||
self.journal.error("already exists")
|
|
||||||
self.journal.closeFile()
|
|
||||||
source_fd.close()
|
|
||||||
return True
|
|
||||||
try:
|
|
||||||
dest_fd = open(dest_file, 'wb')
|
|
||||||
except:
|
|
||||||
self.journal.copyFailed()
|
|
||||||
self.journal.error("can't open dest")
|
|
||||||
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:
|
|
||||||
info(_("COPYING %(source)s ==> %(dest)s") % {"source":source_file, "dest":dest_file})
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
#Nothing left to copy, we quit
|
|
||||||
if self.progress:
|
if self.progress:
|
||||||
self.__pbar_finish()
|
self.__pbar_finish()
|
||||||
self.journal.showErrors()
|
self.journal.showErrors()
|
||||||
self.loop.quit()
|
self.loop.quit()
|
||||||
|
|
||||||
|
source_file, dest_path, options = self.copy_list.pop()
|
||||||
|
self.journal.startFile(source_file)
|
||||||
|
try:
|
||||||
|
source_fd = open(source_file, 'rb')
|
||||||
|
except:
|
||||||
|
self.journal.copyFailed()
|
||||||
|
self.journal.error("can't open source")
|
||||||
|
self.journal.closeFile()
|
||||||
|
return
|
||||||
|
|
||||||
|
filename = os.path.basename(source_file)
|
||||||
|
assert(filename)
|
||||||
|
if options.dest_file:
|
||||||
|
dest_file = self.__filename_fix(options.dest_file, options)
|
||||||
|
else:
|
||||||
|
dest_file = self.__filename_fix(os.path.join(dest_path, filename),
|
||||||
|
options)
|
||||||
|
if os.path.exists(dest_file) and not options.force:
|
||||||
|
warning (_("File [%s] already exists, skipping it!") % dest_file)
|
||||||
|
self.journal.copyFailed()
|
||||||
|
self.journal.error("already exists")
|
||||||
|
self.journal.closeFile()
|
||||||
|
source_fd.close()
|
||||||
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
dest_fd = open(dest_file, 'wb')
|
||||||
|
except:
|
||||||
|
self.journal.copyFailed()
|
||||||
|
self.journal.error("can't open dest")
|
||||||
|
self.journal.closeFile()
|
||||||
|
source_fd.close()
|
||||||
|
return
|
||||||
|
|
||||||
|
GObject.io_add_watch(source_fd, GObject.IO_IN,self._copyFile,
|
||||||
|
(dest_fd, options),
|
||||||
|
priority=GObject.PRIORITY_DEFAULT)
|
||||||
|
if not self.progress:
|
||||||
|
info(_("COPYING %(source)s ==> %(dest)s")
|
||||||
|
% {"source":source_file, "dest":dest_file})
|
||||||
|
|
||||||
def __copyFailed(self, reason, source_fd, dest_fd):
|
def __copyFailed(self, reason, source_fd, dest_fd):
|
||||||
"""Write the failure in the journal and close files descriptors"""
|
"""Write the failure in the journal and close files descriptors"""
|
||||||
self.journal.copyFailed()
|
self.journal.copyFailed()
|
||||||
|
@ -441,19 +455,17 @@ class GCP():
|
||||||
|
|
||||||
def __get_string_size(self, size):
|
def __get_string_size(self, size):
|
||||||
"""Return a nice string representation of a size"""
|
"""Return a nice string representation of a size"""
|
||||||
|
if size >= 2**50:
|
||||||
if size>=2**50:
|
return _("%.2f PiB") % (float(size) / 2**50)
|
||||||
return _("%.2f PiB") % (float(size)/2**50)
|
if size >= 2**40:
|
||||||
elif size>=2**40:
|
return _("%.2f TiB") % (float(size) / 2**40)
|
||||||
return _("%.2f TiB") % (float(size)/2**40)
|
if size >= 2**30:
|
||||||
elif size>=2**30:
|
return _("%.2f GiB") % (float(size) / 2**30)
|
||||||
return _("%.2f GiB") % (float(size)/2**30)
|
if size >= 2**20:
|
||||||
elif size>=2**20:
|
return _("%.2f MiB") % (float(size) / 2**20)
|
||||||
return _("%.2f MiB") % (float(size)/2**20)
|
if size >= 2**10:
|
||||||
elif size>=2**10:
|
return _("%.2f KiB") % (float(size) / 2**10)
|
||||||
return _("%.2f KiB") % (float(size)/2**10)
|
return _("%i B") % size
|
||||||
else:
|
|
||||||
return _("%i B") % size
|
|
||||||
|
|
||||||
def _pbar_update(self):
|
def _pbar_update(self):
|
||||||
"""Update progress bar position, create the bar if it doesn't exist"""
|
"""Update progress bar position, create the bar if it doesn't exist"""
|
||||||
|
@ -461,12 +473,16 @@ class GCP():
|
||||||
try:
|
try:
|
||||||
if self.pbar.maxval != self.bytes_total:
|
if self.pbar.maxval != self.bytes_total:
|
||||||
self.pbar.maxval = self.bytes_total
|
self.pbar.maxval = self.bytes_total
|
||||||
self.pbar.widgets[0] = _("Copying %s") % self.__get_string_size(self.bytes_total)
|
pbar_msg = _("Copying %s") % self.__get_string_size(self.bytes_total)
|
||||||
|
self.pbar.widgets[0] = pbar_msg
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
if not self.bytes_total:
|
if not self.bytes_total:
|
||||||
#No progress bar if the files have a null size
|
# No progress bar if the files have a null size
|
||||||
return
|
return
|
||||||
self.pbar = ProgressBar(self.bytes_total,[_("Copying %s") % self.__get_string_size(self.bytes_total)," ",Percentage()," ",Bar()," ",FileTransferSpeed()," ",ETA()])
|
pbar_msg = _("Copying %s") % self.__get_string_size(self.bytes_total)
|
||||||
|
self.pbar = ProgressBar(self.bytes_total,
|
||||||
|
[pbar_msg, " ", Percentage(), " ", Bar(),
|
||||||
|
" ", FileTransferSpeed(), " ", ETA()])
|
||||||
self.pbar.start()
|
self.pbar.start()
|
||||||
self.pbar.update(self.bytes_copied)
|
self.pbar.update(self.bytes_copied)
|
||||||
|
|
||||||
|
@ -492,7 +508,7 @@ class GCP():
|
||||||
saved_files={}
|
saved_files={}
|
||||||
|
|
||||||
if options.sources_del:
|
if options.sources_del:
|
||||||
if not saved_files.has_key(options.sources_del):
|
if options.sources_del not in saved_files:
|
||||||
error(_("No saved sources with this name, check existing names with --sources-list"))
|
error(_("No saved sources with this name, check existing names with --sources-list"))
|
||||||
else:
|
else:
|
||||||
del saved_files[options.sources_del]
|
del saved_files[options.sources_del]
|
||||||
|
@ -504,7 +520,7 @@ class GCP():
|
||||||
|
|
||||||
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 = saved_files.keys()
|
sources = list(saved_files.keys())
|
||||||
sources.sort()
|
sources.sort()
|
||||||
for source in sources:
|
for source in sources:
|
||||||
info("\t[%s]" % source)
|
info("\t[%s]" % source)
|
||||||
|
@ -516,16 +532,16 @@ class GCP():
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
if options.sources_save or options.sources_replace:
|
if options.sources_save or options.sources_replace:
|
||||||
if saved_files.has_key(options.sources_save) and not options.sources_replace:
|
if options.sources_save in saved_files 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:
|
else:
|
||||||
if len(args)>1:
|
if len(args)>1:
|
||||||
saved_files[options.sources_save] = map(os.path.abspath,args[:-1])
|
saved_files[options.sources_save] = list(map(os.path.abspath,args[:-1]))
|
||||||
with open(os.path.expanduser(const_SAVED_LIST),'w') as saved_fd:
|
with open(os.path.expanduser(const_SAVED_LIST),'w') as saved_fd:
|
||||||
pickle.dump(saved_files,saved_fd)
|
pickle.dump(saved_files,saved_fd)
|
||||||
|
|
||||||
if options.sources_load:
|
if options.sources_load:
|
||||||
if not saved_files.has_key(options.sources_load):
|
if options.sources_load not in saved_files:
|
||||||
error(_("No saved sources with this name, check existing names with --sources-list"))
|
error(_("No saved sources with this name, check existing names with --sources-list"))
|
||||||
else:
|
else:
|
||||||
saved_args = saved_files[options.sources_load]
|
saved_args = saved_files[options.sources_load]
|
||||||
|
@ -548,66 +564,92 @@ class GCP():
|
||||||
for idx in range(len(full_args)):
|
for idx in range(len(full_args)):
|
||||||
full_args[idx] = full_args[idx].encode('utf-8')
|
full_args[idx] = full_args[idx].encode('utf-8')
|
||||||
|
|
||||||
parser = ArgumentParser(usage=_usage)
|
parser = ArgumentParser(usage=_usage,
|
||||||
|
formatter_class=RawDescriptionHelpFormatter)
|
||||||
|
|
||||||
parser.add_argument("-r", "--recursive", action="store_true", default=False,
|
parser.add_argument("-r", "-R", "--recursive",
|
||||||
help=_("copy directories recursively"))
|
action="store_true", default=False,
|
||||||
|
help=_("copy directories recursively")
|
||||||
parser.add_argument("-f", "--force", action="store_true", default=False,
|
)
|
||||||
help=_("force overwriting of existing files"))
|
parser.add_argument("-f", "--force",
|
||||||
|
action="store_true", default=False,
|
||||||
parser.add_argument("--preserve", action="store", default='',
|
help=_("force overwriting of existing files")
|
||||||
help=_("preserve the specified attributes"))
|
)
|
||||||
|
parser.add_argument("-p",
|
||||||
parser.add_argument("-L", "--dereference", action="store_true", default=False,
|
action="store_true", default=False,
|
||||||
help=_("always follow symbolic links in sources"))
|
help=_("same as --preserve=%s" % const_PRESERVE_p)
|
||||||
|
)
|
||||||
parser.add_argument("-P", "--no-dereference", action="store_false", dest='dereference',
|
parser.add_argument("--preserve",
|
||||||
help=_("never follow symbolic links in sources"))
|
action="store", default='',
|
||||||
|
help=_("preserve specified attributes; accepted values: \
|
||||||
#parser.add_argument("--no-unicode-fix", action="store_false", dest='unicode_fix', default=True,
|
'all', or one or more amongst %s") % str(const_PRESERVE)
|
||||||
# help=_("don't fix name encoding errors")) #TODO
|
)
|
||||||
|
parser.add_argument("-L", "--dereference",
|
||||||
parser.add_argument("--fs-fix", choices = const_FS_FIX, dest='fs_fix', default='auto',
|
action="store_true", default=False,
|
||||||
help=_("fix filesystem name incompatibily (default: auto)"))
|
help=_("always follow symbolic links in sources")
|
||||||
|
)
|
||||||
parser.add_argument("--no-fs-fix", action="store_true", dest='no_fs_fix', default=False,
|
parser.add_argument("-P", "--no-dereference",
|
||||||
help=_("same as --fs-fix=no (overrides --fs-fix)"))
|
action="store_false", dest='dereference',
|
||||||
|
help=_("never follow symbolic links in sources")
|
||||||
parser.add_argument("--no-progress", action="store_false", dest="progress", default=True,
|
)
|
||||||
help=_("deactivate progress bar"))
|
#parser.add_argument("--no-unicode-fix",
|
||||||
|
# action="store_false", dest='unicode_fix', default=True,
|
||||||
parser.add_argument("-v", "--verbose", action="store_true", default=False,
|
# help=_("don't fix name encoding errors") #TODO
|
||||||
help=_("Show what is currently done"))
|
#)
|
||||||
|
parser.add_argument("--fs-fix",
|
||||||
parser.add_argument("-V", "--version", action="version", version=ABOUT)
|
choices = const_FS_FIX, dest='fs_fix', default='auto',
|
||||||
|
help=_("fix filesystem name incompatibily (default: auto)")
|
||||||
|
)
|
||||||
|
parser.add_argument("--no-fs-fix",
|
||||||
|
action="store_true", dest='no_fs_fix', default=False,
|
||||||
|
help=_("same as --fs-fix=no (overrides --fs-fix)")
|
||||||
|
)
|
||||||
|
parser.add_argument("--no-progress",
|
||||||
|
action="store_false", dest="progress", default=True,
|
||||||
|
help=_("disable progress bar")
|
||||||
|
)
|
||||||
|
parser.add_argument("-v", "--verbose",
|
||||||
|
action="store_true", default=False,
|
||||||
|
help=_("Show what is currently done")
|
||||||
|
)
|
||||||
|
parser.add_argument("-V", "--version",
|
||||||
|
action="version", version=ABOUT
|
||||||
|
)
|
||||||
|
|
||||||
group_saving = parser.add_argument_group("sources saving")
|
group_saving = parser.add_argument_group("sources saving")
|
||||||
|
group_saving.add_argument("--sources-save",
|
||||||
group_saving.add_argument("--sources-save", action="store",
|
action="store",
|
||||||
help=_("Save source arguments"))
|
help=_("Save source arguments")
|
||||||
|
)
|
||||||
group_saving.add_argument("--sources-replace", action="store",
|
group_saving.add_argument("--sources-replace",
|
||||||
help=_("Save source arguments and replace memory if it already exists"))
|
action="store",
|
||||||
|
help=_("Save source arguments and replace memory if it already exists")
|
||||||
group_saving.add_argument("--sources-load", action="store",
|
)
|
||||||
help=_("Load source arguments"))
|
group_saving.add_argument("--sources-load",
|
||||||
|
action="store",
|
||||||
group_saving.add_argument("--sources-del", action="store",
|
help=_("Load source arguments")
|
||||||
help=_("delete saved sources"))
|
)
|
||||||
|
group_saving.add_argument("--sources-del",
|
||||||
group_saving.add_argument("--sources-list", action="store_true", default=False,
|
action="store",
|
||||||
help=_("List names of saved sources"))
|
help=_("delete saved sources")
|
||||||
|
)
|
||||||
group_saving.add_argument("--sources-full-list", action="store_true", default=False,
|
group_saving.add_argument("--sources-list",
|
||||||
help=_("List names of saved sources and files in it"))
|
action="store_true", default=False,
|
||||||
|
help=_("List names of saved sources")
|
||||||
|
)
|
||||||
|
group_saving.add_argument("--sources-full-list",
|
||||||
|
action="store_true", default=False,
|
||||||
|
help=_("List names of saved sources and files in it")
|
||||||
|
)
|
||||||
parser.add_argument_group(group_saving)
|
parser.add_argument_group(group_saving)
|
||||||
|
|
||||||
|
|
||||||
(options, args) = parser.parse_known_args()
|
(options, args) = parser.parse_known_args()
|
||||||
options.directdir = False #True only in the special case: we are copying a dir and it doesn't exists
|
|
||||||
#options check
|
# True only in the special case: we are copying a dir and it doesn't
|
||||||
|
# exists:
|
||||||
|
options.directdir = False
|
||||||
|
|
||||||
|
# options check
|
||||||
if options.progress and not pbar_available:
|
if options.progress and not pbar_available:
|
||||||
warning (_("Progress bar is not available, deactivating"))
|
warning (_("Progress bar is not available, deactivating"))
|
||||||
options.progress = self.progress = False
|
options.progress = self.progress = False
|
||||||
|
@ -620,18 +662,26 @@ class GCP():
|
||||||
if options.no_fs_fix:
|
if options.no_fs_fix:
|
||||||
options.fs_fix = 'no'
|
options.fs_fix = 'no'
|
||||||
|
|
||||||
if len(options.preserve):
|
preserve = set()
|
||||||
preserve = set(options.preserve.split(','))
|
|
||||||
if not preserve.issubset(const_PRESERVE):
|
|
||||||
error (_("Invalid --preserve value\nvalid values are:"))
|
|
||||||
for value in const_PRESERVE:
|
|
||||||
error('- %s' % value)
|
|
||||||
exit(1)
|
|
||||||
else:
|
|
||||||
options.preserve = preserve
|
|
||||||
|
|
||||||
else:
|
if options.p:
|
||||||
options.preserve=set()
|
preserve.update(const_PRESERVE_p.split(','))
|
||||||
|
|
||||||
|
if options.preserve:
|
||||||
|
preserve.update(options.preserve.split(','))
|
||||||
|
preserve_all = False
|
||||||
|
for value in preserve:
|
||||||
|
if value == 'all':
|
||||||
|
preserve_all = True
|
||||||
|
continue
|
||||||
|
if value not in const_PRESERVE:
|
||||||
|
error (_("Invalid --preserve value '%s'") % value)
|
||||||
|
exit(1)
|
||||||
|
if preserve_all:
|
||||||
|
preserve.remove('all')
|
||||||
|
preserve.update(const_PRESERVE)
|
||||||
|
|
||||||
|
options.preserve = preserve
|
||||||
|
|
||||||
self.__sourcesSaving(options, args)
|
self.__sourcesSaving(options, args)
|
||||||
|
|
||||||
|
|
9
gcp.1
9
gcp.1
|
@ -57,7 +57,7 @@ Show version of program and exit.
|
||||||
.B \-h, \-\-help
|
.B \-h, \-\-help
|
||||||
Show summary of options.
|
Show summary of options.
|
||||||
.TP
|
.TP
|
||||||
.B \-r, \-\-recursive
|
.B \-r, \-R, \-\-recursive
|
||||||
Copy directories recursively.
|
Copy directories recursively.
|
||||||
.TP
|
.TP
|
||||||
.B \-L, \-\-dereference
|
.B \-L, \-\-dereference
|
||||||
|
@ -69,10 +69,13 @@ never follow symbolic links in sources
|
||||||
.B \-f, \-\-force
|
.B \-f, \-\-force
|
||||||
Overwrite existing files.
|
Overwrite existing files.
|
||||||
.TP
|
.TP
|
||||||
|
.B \-p
|
||||||
|
Same as \-\-preserve=mode,ownership,timestamps
|
||||||
|
.TP
|
||||||
.B \-\-preserve=PRESERVE
|
.B \-\-preserve=PRESERVE
|
||||||
Keep specified attributes. Attributes can be mode, ownership and timestamps.
|
Keep specified attributes. Attributes can be mode, ownership and timestamps.
|
||||||
When several attributes are passed, they need to be separated by commas. Note
|
When several attributes are passed, they need to be separated by commas. Note
|
||||||
that timestamps preservation has some limits, see section LIMITS.
|
that timestamps preservation has some limits, see section LIMITATIONS.
|
||||||
.TP
|
.TP
|
||||||
.B \-\-no\-fs\-fix
|
.B \-\-no\-fs\-fix
|
||||||
Don't fix file system naming incompatibilities.
|
Don't fix file system naming incompatibilities.
|
||||||
|
@ -110,7 +113,7 @@ The exit status can be:
|
||||||
\fB1\fP if at least one file has not been copied, or if something went wrong.
|
\fB1\fP if at least one file has not been copied, or if something went wrong.
|
||||||
.IP \[bu]
|
.IP \[bu]
|
||||||
\fB2\fP if all files have been copied but with some issues
|
\fB2\fP if all files have been copied but with some issues
|
||||||
.SH LIMITS
|
.SH LIMITATIONS
|
||||||
Timestamps preservation with \-\-preserve option is limited by the os python
|
Timestamps preservation with \-\-preserve option is limited by the os python
|
||||||
module on POSIX systems. Currently, python only returns timestamps in float
|
module on POSIX systems. Currently, python only returns timestamps in float
|
||||||
format, which is a smaller precision than what POSIX provides. Progress on this
|
format, which is a smaller precision than what POSIX provides. Progress on this
|
||||||
|
|
210
gcp.po
210
gcp.po
|
@ -6,159 +6,257 @@
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: 0.2.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2010-09-27 13:03+0800\n"
|
"POT-Creation-Date: 2018-04-22 20:09+0200\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: English\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=CHARSET\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: gcp:43
|
#: gcp:45
|
||||||
msgid "Error during import"
|
msgid "Error during import"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:44
|
#: gcp:46
|
||||||
msgid "Please check dependecies:"
|
msgid "Please check dependecies:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:50
|
#: gcp:52
|
||||||
msgid ""
|
msgid "ProgressBar not available, please download it at https://pypi.org/"
|
||||||
"ProgressBar not available, please download it at http://pypi.python.org/pypi/"
|
|
||||||
"progressbar"
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:51
|
#: gcp:3
|
||||||
msgid ""
|
msgid ""
|
||||||
"Progress bar deactivated\n"
|
"Progress bar deactivated\n"
|
||||||
"--\n"
|
"--\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:62
|
#: gcp:88
|
||||||
msgid ""
|
|
||||||
"This program comes with ABSOLUTELY NO WARRANTY;\n"
|
|
||||||
"This is free software, and you are welcome to redistribute it\n"
|
|
||||||
"under certain conditions.\n"
|
|
||||||
"---\n"
|
|
||||||
"\n"
|
|
||||||
"This software is an advanced file copier\n"
|
|
||||||
"Get the latest version at http://www.goffi.org\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: gcp:82
|
|
||||||
msgid "Init DbusObject..."
|
msgid "Init DbusObject..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:102
|
#: gcp:109
|
||||||
msgid "INTERNAL ERROR: invalid arguments"
|
msgid "INTERNAL ERROR: invalid arguments"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:119
|
#: gcp:114
|
||||||
|
msgid "INTERNAL ERROR: invalid source_dir"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:169
|
||||||
|
msgid "/!\\ THE FOLLOWING FILES WERE *NOT* SUCCESSFULY COPIED:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:175
|
||||||
|
msgid "The following files were copied, but some errors happened:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:181
|
||||||
|
#, python-format
|
||||||
|
msgid "Please check journal: %s"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:203
|
||||||
msgid "gcp launched"
|
msgid "gcp launched"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:126
|
#: gcp:211
|
||||||
msgid "Init DBus..."
|
msgid "Init DBus..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:155
|
#: gcp:241
|
||||||
msgid "Can't read mounts table"
|
msgid "Can't read mounts table"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:162
|
#: gcp:248
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Adding to copy list: %(path)s ==> %(dest_path)s (%(fs_type)s)"
|
msgid "Adding to copy list: %(path)s ==> %(dest_path)s (%(fs_type)s)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:170 gcp:192
|
#: gcp:253
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Can't copy %(path)s: %(exception)s"
|
msgid "Can't copy %(path)s: %(exception)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:179
|
#: gcp:280
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Creating directory %s"
|
msgid "Can't append %(path)s to copy list: %(exception)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:200
|
#: gcp:283
|
||||||
|
#, python-format
|
||||||
|
msgid "Can't access %(dirpath)s: %(exception)s"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:295
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Invalid dest_path: %s"
|
msgid "Invalid dest_path: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:205
|
#: gcp:300
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "The path given in arg doesn't exist or is not accessible: %s"
|
msgid "The path given in arg doesn't exist or is not accessible: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:210
|
#: gcp:304
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "omitting directory \"%s\""
|
msgid "omitting directory \"%s\""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:226
|
#: gcp:329
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "File [%s] already exists, skipping it !"
|
msgid "File [%s] already exists, skipping it!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:233
|
#: gcp:347
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "COPYING %(source)s ==> %(dest)s"
|
msgid "COPYING %(source)s ==> %(dest)s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:284
|
#: gcp:447
|
||||||
msgid "Progress: "
|
#, python-format
|
||||||
|
msgid "%.2f PiB"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:315
|
#: gcp:449
|
||||||
|
#, python-format
|
||||||
|
msgid "%.2f TiB"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:451
|
||||||
|
#, python-format
|
||||||
|
msgid "%.2f GiB"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:453
|
||||||
|
#, python-format
|
||||||
|
msgid "%.2f MiB"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:455
|
||||||
|
#, python-format
|
||||||
|
msgid "%.2f KiB"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:457
|
||||||
|
#, python-format
|
||||||
|
msgid "%i B"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:465 gcp:470
|
||||||
|
#, python-format
|
||||||
|
msgid "Copying %s"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:497 gcp:530
|
||||||
|
msgid ""
|
||||||
|
"No saved sources with this name, check existing names with --sources-list"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:507
|
||||||
|
msgid "Saved sources:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:521
|
||||||
|
msgid ""
|
||||||
|
"There is already a saved sources with this name, skipping --sources-save"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:557
|
||||||
msgid "copy directories recursively"
|
msgid "copy directories recursively"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:318
|
#: gcp:561
|
||||||
msgid "force overwriting of existing files"
|
msgid "force overwriting of existing files"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:321
|
#: gcp:565
|
||||||
msgid "preserve the specified attributes"
|
#, python-format
|
||||||
|
msgid "same as --preserve=%s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:324
|
#: gcp:569
|
||||||
msgid "don't fixe name encoding errors"
|
#, python-format
|
||||||
|
msgid ""
|
||||||
|
"preserve specified attributes; accepted values: 'all', or one or more "
|
||||||
|
"amongst %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:327
|
#: gcp:574
|
||||||
msgid "deactivate progress bar"
|
msgid "always follow symbolic links in sources"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:330
|
#: gcp:578
|
||||||
|
msgid "never follow symbolic links in sources"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:586
|
||||||
|
msgid "fix filesystem name incompatibily (default: auto)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:590
|
||||||
|
msgid "same as --fs-fix=no (overrides --fs-fix)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:594
|
||||||
|
msgid "disable progress bar"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:598
|
||||||
msgid "Show what is currently done"
|
msgid "Show what is currently done"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:335
|
#: gcp:607
|
||||||
|
msgid "Save source arguments"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:611
|
||||||
|
msgid "Save source arguments and replace memory if it already exists"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:615
|
||||||
|
msgid "Load source arguments"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:619
|
||||||
|
msgid "delete saved sources"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:623
|
||||||
|
msgid "List names of saved sources"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:627
|
||||||
|
msgid "List names of saved sources and files in it"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: gcp:639
|
||||||
msgid "Progress bar is not available, deactivating"
|
msgid "Progress bar is not available, deactivating"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:345
|
#: gcp:663
|
||||||
msgid ""
|
#, python-format
|
||||||
"Invalid --preserve value\n"
|
msgid "Invalid --preserve value '%s'"
|
||||||
"valid values are:"
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:354
|
#: gcp:690
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "There is already one instance of %s running, pluging to it"
|
msgid "There is already one instance of %s running, pluging to it"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:360
|
#: gcp:696
|
||||||
msgid "Wrong number of arguments"
|
msgid "Wrong number of arguments"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:362
|
#: gcp:698
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "adding args to gcp: %s"
|
msgid "adding args to gcp: %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: gcp:373
|
#: gcp:707
|
||||||
msgid "User interruption: good bye"
|
msgid "User interruption: good bye"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
65
setup.py
65
setup.py
|
@ -1,28 +1,47 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
import sys
|
|
||||||
from os import path
|
|
||||||
|
|
||||||
name = 'gcp'
|
name = 'gcp'
|
||||||
|
|
||||||
setup(name=name,
|
setup(
|
||||||
version='0.1.4',
|
name=name,
|
||||||
description=u"gcp is an advanced copy tool loosely inspired from cp",
|
version='0.2.0',
|
||||||
long_description=u'gcp is a command-line tool to copy files, loosely inspired from cp, but with high level functionalities such as progress bar, copy continuation on error, journaling to know which files were successfuly copied, name mangling to workaround filesystem limitations (FAT), unique copy queue, copy list managemet, command arguments close to cp',
|
url='https://code.lm7.fr/mcy/gcp',
|
||||||
author='Goffi (Jérôme Poisson)',
|
license='GPL-3+',
|
||||||
author_email='goffi@goffi.org',
|
|
||||||
url='http://wiki.goffi.org/wiki/Gcp',
|
description="An advanced file copy tool loosely inspired from cp",
|
||||||
classifiers=['Environment :: Console',
|
long_description_content_type='text/markdown',
|
||||||
'Intended Audience :: End Users/Desktop',
|
long_description="""
|
||||||
'License :: OSI Approved :: GNU General Public License (GPL)',
|
**%s** is a command-line tool to copy files, loosely inspired from the `cp`
|
||||||
'Operating System :: POSIX :: Linux',
|
command, but with higher-level functionalities such as progress bar, copy
|
||||||
'Programming Language :: Python',
|
continuation on error, logging to know which files were successfully
|
||||||
'Topic :: Utilities'
|
copied, name mangling to workaround filesystem limitations (FAT), unique
|
||||||
],
|
copy queue, copy list management, etc.""" % name,
|
||||||
data_files=[('share/locale/fr/LC_MESSAGES', ['i18n/fr/LC_MESSAGES/gcp.mo']),
|
keywords='file copy',
|
||||||
('share/man/man1', ["gcp.1"]),
|
|
||||||
('share/doc/%s' % name, ['COPYING','README.md'])],
|
author='Goffi (Jérôme Poisson)',
|
||||||
scripts=['gcp'],
|
author_email='goffi@goffi.org',
|
||||||
)
|
maintainer='Matteo Cypriani',
|
||||||
|
maintainer_email='mcy@lm7.fr',
|
||||||
|
|
||||||
|
# Cf. https://pypi.org/pypi?%3Aaction=list_classifiers
|
||||||
|
classifiers=[
|
||||||
|
'Development Status :: 4 - Beta',
|
||||||
|
'Environment :: Console',
|
||||||
|
'Intended Audience :: End Users/Desktop',
|
||||||
|
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
|
||||||
|
'Operating System :: POSIX :: Linux',
|
||||||
|
'Programming Language :: Python :: 3',
|
||||||
|
'Topic :: Utilities',
|
||||||
|
],
|
||||||
|
|
||||||
|
data_files=[
|
||||||
|
('share/locale/fr/LC_MESSAGES', ['i18n/fr/LC_MESSAGES/gcp.mo']),
|
||||||
|
('share/man/man1', ["gcp.1"]),
|
||||||
|
('share/doc/%s' % name, ['COPYING', 'README.md']),
|
||||||
|
],
|
||||||
|
scripts=['gcp'],
|
||||||
|
install_requires=['PyGObject', 'dbus-python'],
|
||||||
|
python_requires='>=3',
|
||||||
|
)
|
||||||
|
|
120
test_gcp.py
120
test_gcp.py
|
@ -1,9 +1,9 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
gcp: Goffi's CoPier
|
gcp: Goffi's CoPier -- unit tests
|
||||||
Copyright (C) 2010, 2011 Jérôme Poisson <goffi@goffi.org>
|
Copyright (c) 2010, 2011 Jérôme Poisson <goffi@goffi.org>
|
||||||
|
Copyright (c) 2018 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
|
||||||
|
@ -19,29 +19,32 @@ You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import with_statement
|
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
from os import getcwd, chdir, system, mkdir, makedirs, listdir
|
from os import getcwd, chdir, system, mkdir, makedirs, listdir
|
||||||
from os.path import join, isdir
|
from os.path import join, isdir
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
from random import randrange
|
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
|
|
||||||
#size shorcuts
|
# gcp command. This assumes gcp is in the PATH. Alternatively, we could use
|
||||||
|
# something like this to use gcp from the current directory:
|
||||||
|
#GCP = join(getcwd(), "gcp")
|
||||||
|
GCP = 'gcp'
|
||||||
|
|
||||||
|
# Size shorcuts
|
||||||
S10K = 1024 * 10
|
S10K = 1024 * 10
|
||||||
S100K = 1024 * 100
|
S100K = 1024 * 100
|
||||||
S1M = 1024 * 1024
|
S1M = 1024 * 1024
|
||||||
S10M = 1024 * 1024 * 10
|
S10M = 1024 * 1024 * 10
|
||||||
S100M = 1024 * 1024 * 100
|
S100M = 1024 * 1024 * 100
|
||||||
|
|
||||||
|
|
||||||
def sha1sum(filename, buf_size=4096):
|
def sha1sum(filename, buf_size=4096):
|
||||||
"""Return the SHA1 hash of a file
|
"""Returns the SHA1 hash of a file.
|
||||||
@param filename: path to the file
|
@param filename: path to the file
|
||||||
@param buf_size: size of the buffer to use for calculation"""
|
@param buf_size: size of the buffer to use for calculation
|
||||||
|
"""
|
||||||
csum = sha1()
|
csum = sha1()
|
||||||
with open(filename) as fd:
|
with open(filename, 'rb') as fd:
|
||||||
data = fd.read(buf_size)
|
data = fd.read(buf_size)
|
||||||
while data:
|
while data:
|
||||||
csum.update(data)
|
csum.update(data)
|
||||||
|
@ -49,7 +52,7 @@ def sha1sum(filename, buf_size=4096):
|
||||||
return csum.digest()
|
return csum.digest()
|
||||||
|
|
||||||
def dirCheck(dir_path):
|
def dirCheck(dir_path):
|
||||||
"""Recursively calculate SHA1 sum of a dir
|
"""Recursively calculates SHA1 sums in a directory.
|
||||||
@param path: path of the dir to check
|
@param path: path of the dir to check
|
||||||
@return: a dict in the form [{filepath: sum,...}]
|
@return: a dict in the form [{filepath: sum,...}]
|
||||||
"""
|
"""
|
||||||
|
@ -69,11 +72,12 @@ def dirCheck(dir_path):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
#def makeRandomFile(path, size, buf_size=4096):
|
#def makeRandomFile(path, size, buf_size=4096):
|
||||||
# """Create a fake file
|
# """Creates a fake file.
|
||||||
# @param path: where the file is created
|
# @param path: where the file is created
|
||||||
# @param size: size of the file to create in bytes"""
|
# @param size: size of the file to create in bytes
|
||||||
|
# """
|
||||||
# def seq(size):
|
# def seq(size):
|
||||||
# return ''.join(chr(randrange(256)) for i in range(size))
|
# return ''.join(chr(random.randrange(256)) for i in range(size))
|
||||||
# fd = open(path, 'w')
|
# fd = open(path, 'w')
|
||||||
# for byte in range(size//buf_size):
|
# for byte in range(size//buf_size):
|
||||||
# fd.write(seq(buf_size))
|
# fd.write(seq(buf_size))
|
||||||
|
@ -81,20 +85,22 @@ def dirCheck(dir_path):
|
||||||
# fd.close()
|
# fd.close()
|
||||||
|
|
||||||
def makeRandomFile(path, size=S10K, buf_size=4096):
|
def makeRandomFile(path, size=S10K, buf_size=4096):
|
||||||
"""Create a fake file using /dev/urandom
|
"""Creates a fake file using /dev/urandom.
|
||||||
@param path: where the file must be created
|
@param path: where the file must be created
|
||||||
@param size: size of the file to create in bytes"""
|
@param size: size of the file to create in bytes
|
||||||
source = open('/dev/urandom','r')
|
"""
|
||||||
dest = open(path, 'w')
|
source = open('/dev/urandom', 'rb')
|
||||||
for byte in range(size//buf_size):
|
dest = open(path, 'wb')
|
||||||
|
for _ in range(size // buf_size):
|
||||||
dest.write(source.read(buf_size))
|
dest.write(source.read(buf_size))
|
||||||
dest.write(source.read(size%buf_size))
|
dest.write(source.read(size % buf_size))
|
||||||
dest.close()
|
dest.close()
|
||||||
|
source.close()
|
||||||
|
|
||||||
def makeTestDir(path):
|
def makeTestDir(path):
|
||||||
"""Helper method to easily create a test dir
|
"""Helper method to easily create a test directory.
|
||||||
@param path: where the dir must be created"""
|
@param path: where the dir must be created
|
||||||
|
"""
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
subdir = join(path,'subdir_%d' % i)
|
subdir = join(path,'subdir_%d' % i)
|
||||||
makedirs(subdir)
|
makedirs(subdir)
|
||||||
|
@ -104,8 +110,8 @@ def makeTestDir(path):
|
||||||
makeRandomFile(join(path,'file_%d' % i), S10K)
|
makeRandomFile(join(path,'file_%d' % i), S10K)
|
||||||
|
|
||||||
class TestCopyCases(unittest.TestCase):
|
class TestCopyCases(unittest.TestCase):
|
||||||
"""Test basic copy use cases, using gcp externally
|
"""Test basic copy use cases, using gcp externally.
|
||||||
gcp must be available in the PATH"""
|
"""
|
||||||
#TODO: check journal
|
#TODO: check journal
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -118,109 +124,121 @@ class TestCopyCases(unittest.TestCase):
|
||||||
rmtree(self.tmp_dir)
|
rmtree(self.tmp_dir)
|
||||||
|
|
||||||
def test_one_file_copy(self):
|
def test_one_file_copy(self):
|
||||||
"""Copy one file and test the result"""
|
"""Copies one file and tests the result.
|
||||||
|
"""
|
||||||
makeRandomFile('file_1', S10K)
|
makeRandomFile('file_1', S10K)
|
||||||
ori_sum = sha1sum('file_1')
|
ori_sum = sha1sum('file_1')
|
||||||
ret = system("gcp file_1 file_2")
|
ret = system(GCP + " file_1 file_2")
|
||||||
self.assertEqual(ret,0)
|
self.assertEqual(ret,0)
|
||||||
dest_sum = sha1sum('file_2')
|
dest_sum = sha1sum('file_2')
|
||||||
self.assertEqual(ori_sum, dest_sum)
|
self.assertEqual(ori_sum, dest_sum)
|
||||||
|
|
||||||
def test_one_file_copy_already_exists(self):
|
def test_one_file_copy_already_exists(self):
|
||||||
"""Check that an existing file is not overwritten"""
|
"""Checks that an existing file is not overwritten.
|
||||||
|
"""
|
||||||
makeRandomFile('file_1', S10K)
|
makeRandomFile('file_1', S10K)
|
||||||
makeRandomFile('file_2', S10K)
|
makeRandomFile('file_2', S10K)
|
||||||
file_2_sum = sha1sum('file_2')
|
file_2_sum = sha1sum('file_2')
|
||||||
ret = system("gcp file_1 file_2")
|
ret = system(GCP + " file_1 file_2")
|
||||||
self.assertNotEqual(ret,0)
|
self.assertNotEqual(ret,0)
|
||||||
file_2_sum_bis = sha1sum('file_2')
|
file_2_sum_bis = sha1sum('file_2')
|
||||||
self.assertEqual(file_2_sum, file_2_sum_bis)
|
self.assertEqual(file_2_sum, file_2_sum_bis)
|
||||||
|
|
||||||
def test_one_file_copy_already_exists_force(self):
|
def test_one_file_copy_already_exists_force(self):
|
||||||
"""Check that an existing file is overwritten with --force"""
|
"""Checks that an existing file is overwritten with --force.
|
||||||
|
"""
|
||||||
makeRandomFile('file_1', S10K)
|
makeRandomFile('file_1', S10K)
|
||||||
makeRandomFile('file_2', S10K)
|
makeRandomFile('file_2', S10K)
|
||||||
file_1_sum = sha1sum('file_1')
|
file_1_sum = sha1sum('file_1')
|
||||||
ret = system("gcp -f file_1 file_2")
|
ret = system(GCP + " -f file_1 file_2")
|
||||||
self.assertEqual(ret,0)
|
self.assertEqual(ret,0)
|
||||||
file_2_sum_bis = sha1sum('file_2')
|
file_2_sum_bis = sha1sum('file_2')
|
||||||
self.assertEqual(file_1_sum, file_2_sum_bis)
|
self.assertEqual(file_1_sum, file_2_sum_bis)
|
||||||
|
|
||||||
def test_one_dir_copy(self):
|
def test_one_dir_copy(self):
|
||||||
"""Check copy of one dir to a non existant path"""
|
"""Checks copy of a directory to a non-existent path.
|
||||||
|
"""
|
||||||
makeTestDir('dir_1')
|
makeTestDir('dir_1')
|
||||||
check_1 = dirCheck('dir_1')
|
check_1 = dirCheck('dir_1')
|
||||||
ret = system("gcp -r dir_1 dir_2")
|
ret = system(GCP + " -r dir_1 dir_2")
|
||||||
self.assertEqual(ret,0)
|
self.assertEqual(ret,0)
|
||||||
check_2 = dirCheck('dir_2')
|
check_2 = dirCheck('dir_2')
|
||||||
self.assertEqual(check_1, check_2)
|
self.assertEqual(check_1, check_2)
|
||||||
|
|
||||||
def test_one_dir_copy_nocopy(self):
|
def test_one_dir_copy_nocopy(self):
|
||||||
"""Check that a dir is not copied without the recursive option"""
|
"""Checks that a directory is not copied without the recursive option.
|
||||||
|
"""
|
||||||
makeTestDir('dir_1')
|
makeTestDir('dir_1')
|
||||||
check_before = dirCheck('.')
|
check_before = dirCheck('.')
|
||||||
ret = system("gcp dir_1 dir_2")
|
ret = system(GCP + " dir_1 dir_2")
|
||||||
self.assertEqual(ret,0)
|
self.assertEqual(ret,0)
|
||||||
check_after = dirCheck('.')
|
check_after = dirCheck('.')
|
||||||
self.assertEqual(check_before, check_after)
|
self.assertEqual(check_before, check_after)
|
||||||
|
|
||||||
def test_one_dir_copy_existing_dest(self):
|
def test_one_dir_copy_existing_dest(self):
|
||||||
"""Check that a dir is copied inside an existing destination"""
|
"""Checks that a directory is copied inside an existing destination.
|
||||||
|
"""
|
||||||
makeTestDir('dir_1')
|
makeTestDir('dir_1')
|
||||||
mkdir('dir_2')
|
mkdir('dir_2')
|
||||||
check_1 = dirCheck('dir_1')
|
check_1 = dirCheck('dir_1')
|
||||||
ret = system("gcp -r dir_1 dir_2")
|
ret = system(GCP + " -r dir_1 dir_2")
|
||||||
self.assertEqual(ret,0)
|
self.assertEqual(ret,0)
|
||||||
self.assertEqual(listdir('dir_2'), ['dir_1'])
|
self.assertEqual(listdir('dir_2'), ['dir_1'])
|
||||||
check_2 = dirCheck('dir_2/dir_1')
|
check_2 = dirCheck('dir_2/dir_1')
|
||||||
self.assertEqual(check_1, check_2)
|
self.assertEqual(check_1, check_2)
|
||||||
|
|
||||||
def test_mixt_copy_existing_dest(self):
|
def test_mixed_copy_existing_dest(self):
|
||||||
"""Check that a mixt copy (files + dir) to an existing dest work as expected"""
|
"""Mixed copy (files + dir) to an existing destination.
|
||||||
|
"""
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
makeRandomFile('file_%d' % i, S10K)
|
makeRandomFile('file_%d' % i, S10K)
|
||||||
makeTestDir('dir_%d' % i)
|
makeTestDir('dir_%d' % i)
|
||||||
check_1 = dirCheck('.')
|
check_1 = dirCheck('.')
|
||||||
mkdir('dest_dir')
|
mkdir('dest_dir')
|
||||||
ret = system("gcp -r file_0 file_1 dir_0 dir_1 dest_dir")
|
ret = system(GCP + " -r file_0 file_1 dir_0 dir_1 dest_dir")
|
||||||
self.assertEqual(ret,0)
|
self.assertEqual(ret,0)
|
||||||
check_2 = dirCheck('dest_dir')
|
check_2 = dirCheck('dest_dir')
|
||||||
self.assertEqual(check_1, check_2)
|
self.assertEqual(check_1, check_2)
|
||||||
|
|
||||||
def test_mixt_copy_nonexisting_dest(self):
|
def test_mixed_copy_nonexisting_dest(self):
|
||||||
"""Check that a mixt copy (files + dir) to an non existing dest work as expected
|
"""Mixed copy (files + dir) to an inexistant destination.
|
||||||
/!\\ the behavious is different of the one of cp in this case ! (cp doesn't copy at all, while gcp create the dest)"""
|
/!\\ The behaviour is different than cp's! (cp doesn't copy at all,
|
||||||
|
while gcp create the destintation directory.)
|
||||||
|
"""
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
makeRandomFile('file_%d' % i, S10K)
|
makeRandomFile('file_%d' % i, S10K)
|
||||||
makeTestDir('dir_%d' % i)
|
makeTestDir('dir_%d' % i)
|
||||||
check_1 = dirCheck('.')
|
check_1 = dirCheck('.')
|
||||||
ret = system("gcp -r file_0 file_1 dir_0 dir_1 dest_dir")
|
ret = system(GCP + " -r file_0 file_1 dir_0 dir_1 dest_dir")
|
||||||
self.assertEqual(ret,0)
|
self.assertEqual(ret,0)
|
||||||
check_2 = dirCheck('dest_dir')
|
check_2 = dirCheck('dest_dir')
|
||||||
self.assertEqual(check_1, check_2)
|
self.assertEqual(check_1, check_2)
|
||||||
|
|
||||||
def test_mixt_copy_existing_dest_nonrecursive(self):
|
def test_mixed_copy_existing_dest_nonrecursive(self):
|
||||||
"""Check that a mixt copy (files + dir) to an existing dest without the recursive option work as expected"""
|
"""Non-recursive mixed copy (files + dir) to an existing destination.
|
||||||
|
"""
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
makeRandomFile('file_%d' % i, S10K)
|
makeRandomFile('file_%d' % i, S10K)
|
||||||
makeTestDir('dir_%d' % i)
|
makeTestDir('dir_%d' % i)
|
||||||
mkdir('dest_dir')
|
mkdir('dest_dir')
|
||||||
ret = system("gcp file_0 file_1 dir_0 dir_1 dest_dir")
|
ret = system(GCP + " file_0 file_1 dir_0 dir_1 dest_dir")
|
||||||
self.assertEqual(ret,0)
|
self.assertEqual(ret,0)
|
||||||
self.assertEqual(set(listdir('dest_dir')), set(['file_0', 'file_1']))
|
self.assertEqual(set(listdir('dest_dir')), set(['file_0', 'file_1']))
|
||||||
self.assertEqual(sha1sum('file_0'), sha1sum('dest_dir/file_0'))
|
self.assertEqual(sha1sum('file_0'), sha1sum('dest_dir/file_0'))
|
||||||
self.assertEqual(sha1sum('file_1'), sha1sum('dest_dir/file_1'))
|
self.assertEqual(sha1sum('file_1'), sha1sum('dest_dir/file_1'))
|
||||||
|
|
||||||
def test_mixt_copy_nonexisting_dest_nonrecursive(self):
|
def test_mixed_copy_nonexisting_dest_nonrecursive(self):
|
||||||
"""Check that a mixt copy (files + dir) to an existing dest without the recursive option work as expected"""
|
"""Non-recursive mixed copy (files + dir) to an inexistant destination.
|
||||||
|
"""
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
makeRandomFile('file_%d' % i, S10K)
|
makeRandomFile('file_%d' % i, S10K)
|
||||||
makeTestDir('dir_%d' % i)
|
makeTestDir('dir_%d' % i)
|
||||||
check_before = dirCheck('.')
|
check_before = dirCheck('.')
|
||||||
ret = system("gcp file_0 file_1 dir_0 dir_1 dest_dir")
|
ret = system(GCP + " file_0 file_1 dir_0 dir_1 dest_dir")
|
||||||
self.assertEqual(ret >> 8, 1)
|
self.assertEqual(ret >> 8, 1)
|
||||||
check_after = dirCheck('.')
|
check_after = dirCheck('.')
|
||||||
self.assertEqual(check_before, check_after)
|
self.assertEqual(check_before, check_after)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue