Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PKG-INFO
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ Author: Guillaume Aubert
Author-email: [email protected]
License: GPL v3.0
Description: Gmvault is a tool allowing users to backup and restore their gmail account. This tool allows one shot backups or regular backups.
Gmvault will restore your gmail account as it was. Don't let that part of your life disapear.
Gmvault will restore your gmail account as it was. Don't let that part of your life disappear.

Platform: UNKNOWN
2 changes: 1 addition & 1 deletion RELEASE-NOTE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ New Features:
- GTalk chats can be restored in any accounts in the label gmvault-chats as the official Gmail Chats label in read-only.
- Add the check command for cleaning your Gmvault db. With check, Gmvault-db will reflect your Gmail account and emails that have been trashed on Gmail will be deleted from the Gmvault-db.
- The check option used to keep in sync the Gmvault-db with your Gmail account is now by default activated in the sync mode. Use option "--check-db" no to deactivate it.
Beware if you have a Gmvault db containg emails from multiple accounts: You will have to resync in quick mode with --db-cleaning no with both accounts to no have part of it deleted.
Beware if you have a Gmvault db containing emails from multiple accounts: You will have to resync in quick mode with --db-cleaning no with both accounts to no have part of it deleted.
- Add options --chats-only and --emails-only to synchronise only emails or chats.
- Create default configuration file $HOME/.gmvault/gmvault_defaults.conf in order to make some options customisable.
- Change quick sync time to 7 days and restore time to one month to speed-up the quick modes. It can be configured in $HOME/.gmvault/gmvault_defaults.conf.
Expand Down
16 changes: 8 additions & 8 deletions src/gmv/blowfish.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ def encrypt(self, data):
'len': len(data),
})

# Use big endianess since that's what everyone else uses
# Use big endianness since that's what everyone else uses
xl = (ord(data[3])) | (ord(data[2]) << 8) | (ord(data[1]) << 16) | (ord(data[0]) << 24)
xr = (ord(data[7])) | (ord(data[6]) << 8) | (ord(data[5]) << 16) | (ord(data[4]) << 24)

Expand All @@ -457,7 +457,7 @@ def decrypt(self, data):
'len': len(data),
})

# Use big endianess since that's what everyone else uses
# Use big endianness since that's what everyone else uses
cl = (ord(data[3])) | (ord(data[2]) << 8) | (ord(data[1]) << 16) | (ord(data[0]) << 24)
cr = (ord(data[7])) | (ord(data[6]) << 8) | (ord(data[5]) << 16) | (ord(data[4]) << 24)

Expand Down Expand Up @@ -551,17 +551,17 @@ def _demo(heading, source, encrypted, decrypted):

# Block processing
text = 'testtest'
crypted = cipher.encrypt(text)
decrypted = cipher.decrypt(crypted)
_demo("Testing block encrypt", text, repr(crypted), decrypted)
encrypted = cipher.encrypt(text)
decrypted = cipher.decrypt(encrypted)
_demo("Testing block encrypt", text, repr(encrypted), decrypted)

# CTR ptocessing
cipher.initCTR()
text = "The quick brown fox jumps over the lazy dog"
crypted = cipher.encryptCTR(text)
encrypted = cipher.encryptCTR(text)
cipher.initCTR()
decrypted = cipher.decryptCTR(crypted)
_demo("Testing CTR logic", text, repr(crypted), decrypted)
decrypted = cipher.decryptCTR(encrypted)
_demo("Testing CTR logic", text, repr(encrypted), decrypted)

# Test speed
print "Testing speed"
Expand Down
2 changes: 1 addition & 1 deletion src/gmv/cmdline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CmdLineParser(argparse.ArgumentParser): #pylint: disable=R0904
Comments regarding usability of the lib.
By default you want to print the default in the help if you had them so the default formatter should print them
Also new lines are eaten in the epilogue strings. You would use an epilogue to show examples most of the time so you
want to have the possiblity to go to a new line. There should be a way to format the epilogue differently from the rest
want to have the possibility to go to a new line. There should be a way to format the epilogue differently from the rest

"""

Expand Down
12 changes: 6 additions & 6 deletions src/gmv/conf/conf_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

class ResourceError(Exception):
"""
Base class for ressource exceptions
Base class for resource exceptions
"""

def __init__(self, a_msg):
Expand All @@ -35,19 +35,19 @@ def __init__(self, a_msg):

class Resource(object):
"""
Class read a ressource.
Class read a resource.
It can be read first from the Command Line, then from the ENV as an env variable and finally from a conf file
"""

def __init__(self, a_cli_argument=None, a_env_variable=None, a_conf_property=None):
"""
Default Constructor.
It is important to understand that there is precedence between the different ways to set the ressource:
It is important to understand that there is precedence between the different ways to set the resource:
- get from the command line if defined otherwise get from the Env variable if defined otherwise get from the conf file otherwise error

Args:
a_cli_argument : The command line argument name
a_env_variable : The env variable name used for this ressource
a_env_variable : The env variable name used for this resource
a_conf_property: It should be a tuple containing two elements (group,property)
"""

Expand Down Expand Up @@ -83,7 +83,7 @@ def _get_srandardized_cli_argument(cls, a_tostrip):
def _get_value_from_command_line(self):
"""
internal method for extracting the value from the command line.
All command line agruments must be lower case (unix style).
All command line arguments must be lower case (unix style).
To Do support short and long cli args.

Returns:
Expand Down Expand Up @@ -331,7 +331,7 @@ class Conf(object):
* support for variables in configuration file
* support for default values in all accessors
* integrated with the resources object offering to get the configuration from an env var, a commandline option or the conf
* to be done : support for blocs, list comprehension and dict comprehension, json
* to be done : support for blocks, list comprehension and dict comprehension, json
* to be done : define resources in the conf using the [Resource] group with A= { ENV:TESTVAR, CLI:--testvar, VAL:1.234 }

"""
Expand Down
2 changes: 1 addition & 1 deletion src/gmv/conf/tests/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# author: [email protected]
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# use the resources to get ENV Variables. Use of a special group ENV : %(ENV[HOME])
# use the resources to get CLI Values. Use fo a special group CLI: %(CLI[Longname] or CLI[--Longname] or CLI[-longname]
# use the resources to get CLI Values. Use of a special group CLI: %(CLI[Longname] or CLI[--Longname] or CLI[-longname]

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Name : GroupTest1
Expand Down
2 changes: 1 addition & 1 deletion src/gmv/conf/utils/struct_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def _compile_litteral(self, a_tokenizer):
dummy = the_token.value[1:-1]

elif the_token.type == 'NAME':
# intepret all non quoted names as a string
# interpret all non quoted names as a string
dummy = the_token.value

elif the_token.type == 'NUMBER':
Expand Down
2 changes: 1 addition & 1 deletion src/gmv/credential_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def get_oauth2_credential(cls, email, renew_cred = False):
"""
Used once the connection has been lost. Return an auth_str obtained from a refresh token or
with the current access token if it is still valid
:param email: user email used to load refresh token from peristent file
:param email: user email used to load refresh token from persistent file
:return: credential { 'type' : 'oauth2', 'value' : auth_str, 'option':None }
"""
oauth2_creds = cls.read_oauth2_tok_sec(email)
Expand Down
6 changes: 3 additions & 3 deletions src/gmv/gmv_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@

class NotSeenAction(argparse.Action): #pylint:disable=R0903,w0232
"""
to differenciate between a seen and non seen command
to differentiate between a seen and non seen command
"""
def __call__(self, parser, namespace, values, option_string=None):
if values:
Expand Down Expand Up @@ -835,7 +835,7 @@ def setup_default_conf():
"""
set the environment GMVAULT_CONF_FILE which is necessary for Conf object
"""
gmvault_utils.get_conf_defaults() # force instanciation of conf to load the defaults
gmvault_utils.get_conf_defaults() # force instantiation of conf to load the defaults

def bootstrap_run():
""" temporary bootstrap """
Expand All @@ -856,7 +856,7 @@ def bootstrap_run():
LOG.critical("Activate debugging information.")
activate_debug_mode()

# force instanciation of conf to load the defaults
# force instantiation of conf to load the defaults
gmvault_utils.get_conf_defaults()

gmvlt.run(args)
Expand Down
15 changes: 8 additions & 7 deletions src/gmv/gmvault.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def handle_restore_imap_error(the_exception, gm_id, db_gmail_ids_info, gmvaulter
gmvaulter.src.reconnect() #reconnect

elif isinstance(the_exception, imaplib.IMAP4.error):
LOG.error("Catched IMAP Error %s" % (str(the_exception)))
LOG.error("Caught IMAP Error %s" % (str(the_exception)))
LOG.exception(the_exception)

#When the email cannot be read from Database because it was empty when returned by gmail imap
Expand Down Expand Up @@ -271,7 +271,7 @@ def __init__(self, db_root_dir, host, port, login, \
#instantiate gstorer
self.gstorer = gmvault_db.GmailStorer(self.db_root_dir, self.use_encryption)

#timer used to mesure time spent in the different values
#timer used to measure time spent in the different values
self.timer = gmvault_utils.Timer()

@classmethod
Expand All @@ -289,7 +289,8 @@ def get_operation_report(self):
"""
the_str = "\n================================================================\n"\
"%s operation performed in %s.\n" \
"Number of reconnections: %d.\nNumber of emails quarantined: %d.\n" \
"Number of reconnections: %d.\n" \
"Number of emails quarantined: %d.\n" \
"Number of emails that could not be fetched: %d.\n" \
"Number of emails that were returned empty by gmail: %d.\n"\
"Number of emails without label information returned by gmail: %d.\n"\
Expand Down Expand Up @@ -634,7 +635,7 @@ def sync(self, imap_req, compress_on_disk = True, \
else:
LOG.critical("\nSkip chats synchronization.\n")

#delete supress emails from DB since last sync
#delete suppress emails from DB since last sync
self.check_clean_db(db_cleaning)

LOG.debug("Sync operation performed in %s.\n" \
Expand Down Expand Up @@ -775,7 +776,7 @@ def check_clean_db(self, db_cleaning):

LOG.debug("Got %s emails imap_id(s) from the Gmail Server." % (len(imap_ids)))

#delete supress emails from DB since last sync
#delete suppress emails from DB since last sync
self._delete_sync(imap_ids, db_gmail_ids, db_gmail_ids_info, 'email')

# get all chats ids
Expand All @@ -792,7 +793,7 @@ def check_clean_db(self, db_cleaning):

LOG.debug("Got %s chat imap_ids from the Gmail Server." % (len(chat_ids)))

#delete supress emails from DB since last sync
#delete suppress emails from DB since last sync
self._delete_sync(chat_ids, db_chat_ids, db_gmail_ids_info , 'chat')
else:
LOG.critical("Chats IMAP Directory not visible on Gmail. Ignore deletion of chats.")
Expand Down Expand Up @@ -1055,7 +1056,7 @@ def restore_emails(self, pivot_dir = None, extra_labels = [], restart = False):
restore emails in a gmail account using batching to group restore
If you are not in "All Mail" Folder, it is extremely fast to push emails.
But it is not possible to reapply labels if you are not in All Mail because the uid which is returned
is dependant on the folder. On the other hand, you can restore labels in batch which would help gaining lots of time.
is dependent on the folder. On the other hand, you can restore labels in batch which would help gaining lots of time.
The idea is to get a batch of 50 emails and push them all in the mailbox one by one and get the uid for each of them.
Then create a dict of labels => uid_list and for each label send a unique store command after having changed dir
"""
Expand Down
2 changes: 1 addition & 1 deletion src/gmv/gmvault_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

class GMVaultExporter(object):
"""
Class hanlding the creation of exports in standard formats
Class handling the creation of exports in standard formats
such as maildir, mbox
"""
PROGRESS_INTERVAL = 200
Expand Down
14 changes: 7 additions & 7 deletions src/gmv/gmvault_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def __get__(self, obj, objtype):
return functools.partial(self.__call__, obj)

class Curry:
""" Class used to implement the currification (functional programming technic) :
Create a function from another one by instanciating some of its parameters.
""" Class used to implement the currification (functional programming technique) :
Create a function from another one by instantiating some of its parameters.
For example double = curry(operator.mul,2), res = double(4) = 8
"""
def __init__(self, fun, *args, **kwargs):
Expand Down Expand Up @@ -126,7 +126,7 @@ def get_exception_traceback():

def remove_consecutive_spaces_and_strip(a_str):
"""
Supress consecutive spaces to replace them with a unique one.
Suppress consecutive spaces to replace them with a unique one.
e.g "two spaces" = "two spaces"
"""
#return re.sub("\s{2,}", " ", a_str, flags=re.U).strip()
Expand All @@ -137,7 +137,7 @@ def remove_consecutive_spaces_and_strip(a_str):

class Timer(object):
"""
Timer Class to mesure time.
Timer Class to measure time.
Possess also few time utilities
"""

Expand Down Expand Up @@ -347,7 +347,7 @@ def get_all_dirs_under(root_dir, ignored_dirs = []):#pylint:disable=W0102

def datetime2imapdate(a_datetime):
"""
Transfrom in date format for IMAP Request
Transform in date format for IMAP Request
"""
if a_datetime:

Expand Down Expand Up @@ -589,7 +589,7 @@ def convert_argv_to_unicode(a_str):
except Exception, err:
LOG.error(err)
get_exception_traceback()
LOG.info("Convertion of %s from %s to a unicode failed. Will now convert to unicode using utf-8 encoding and ignoring errors (non utf-8 characters will be eaten)." % (a_str, terminal_encoding))
LOG.info("Conversion of %s from %s to a unicode failed. Will now convert to unicode using utf-8 encoding and ignoring errors (non utf-8 characters will be eaten)." % (a_str, terminal_encoding))
LOG.info("Please set properly the Terminal encoding or use the [Localisation]:terminal_encoding property to set it.")
u_str = unicode(a_str, encoding='utf-8', errors='ignore')

Expand Down Expand Up @@ -633,7 +633,7 @@ def get_conf_defaults():

return the_cf
else:
return gmv.conf.conf_helper.MockConf() #retrun MockObject that will play defaults
return gmv.conf.conf_helper.MockConf() #return MockObject that will play defaults

#VERSION DETECTION PATTERN
VERSION_PATTERN = r'\s*conf_version=\s*(?P<version>\S*)\s*'
Expand Down
2 changes: 1 addition & 1 deletion src/gmv/imap_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def select_folder(self, a_folder_name, use_predef_names = True):
@retry(3,1,2) # try 3 times to reconnect with a sleep time of 1 sec and a backoff of 2. The fourth time will wait 4 sec
def list_all_folders(self):
"""
Return all folders mainly for debuging purposes
Return all folders mainly for debugging purposes
"""
return self.server.xlist_folders()

Expand Down
4 changes: 2 additions & 2 deletions src/gmv/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def diff_online_mailboxes(gmvaulter_a, gmvaulter_b): #pylint: disable=R0912, R09

#dumb search not optimisation
#iterate over imap_ids_a and flag emails only in a but not in b
#remove emails from imap_ids_b everytime they are found
#remove emails from imap_ids_b every time they are found
for data_infos in batch_fetcher_a:
for gm_info in data_infos:
gm_id = data_infos[gm_info]['X-GM-MSGID']
Expand Down Expand Up @@ -376,7 +376,7 @@ def print_diff_result(diff_result):

def assert_login_is_protected(login):
"""
Insure that the login is not my personnal mailbox
Insure that the login is not my personal mailbox
"""
if login != '[email protected]':
raise Exception("Beware login should be [email protected] and it is %s" % (login))
Expand Down
2 changes: 1 addition & 1 deletion src/gmvault_essential_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def setUp(self): #pylint:disable-msg=C0103
self.gmvault_test_login, self.gmvault_test_passwd = test_utils.read_password_file('/homespace/gaubert/.ssh/gmvault_test_passwd')
self.ba_login, self.ba_passwd = test_utils.read_password_file('/homespace/gaubert/.ssh/ba_passwd')

#xoauth hanlding
#xoauth handling
self.ga_login = '[email protected]'
self.ga_cred = test_utils.get_oauth_cred(self.ga_login, '/homespace/gaubert/.ssh/ga_oauth')

Expand Down
2 changes: 1 addition & 1 deletion src/perf_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _create_dirs(self, working_dir, nb_dirs, nb_files_per_dir):

def test_read_lots_of_files(self):
"""
Test to mesure how long it takes to list over 100 000 files
Test to measure how long it takes to list over 100 000 files
On server: 250 000 meta files in 50 dirs (50,5000) => 9.74 sec to list them
100 000 meta files in 20 dirs (20,5000) => 3.068 sec to list them
60 000 meta files in 60 dirs (60,1000) => 1.826 sec to list them
Expand Down
Loading