Skip to content

Commit

Permalink
Slightly improve code style
Browse files Browse the repository at this point in the history
  • Loading branch information
daviewales committed Jan 15, 2025
1 parent 8dab4d9 commit cf8a23a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
8 changes: 4 additions & 4 deletions common/encfstools.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from packaging.version import Version
import config
import password
import password_ipc
from password_ipc import TempPasswordThread
import tools
import sshtools
import logger
Expand Down Expand Up @@ -56,7 +56,7 @@ def _mount(self):
if self.password is None:
self.password = self.config.password(self.parent, self.profile_id, self.mode)
logger.debug('Provide password through temp FIFO', self)
thread = password_ipc.TempPasswordThread(self.password)
thread = TempPasswordThread(self.password)
env = self.env()
env['ASKPASS_TEMP'] = thread.temp_file
with thread.starter():
Expand Down Expand Up @@ -363,7 +363,7 @@ def startProcess(self):
"""
start 'encfsctl encode' process in pipe mode.
"""
thread = password_ipc.TempPasswordThread(self.password)
thread = TempPasswordThread(self.password)
env = self.encfs.env()
env['ASKPASS_TEMP'] = thread.temp_file
with thread.starter():
Expand Down Expand Up @@ -595,7 +595,7 @@ def startProcess(self):
"""
start 'encfsctl decode' process in pipe mode.
"""
thread = password_ipc.TempPasswordThread(self.password)
thread = TempPasswordThread(self.password)
env = os.environ.copy()
env['ASKPASS_TEMP'] = thread.temp_file
with thread.starter():
Expand Down
14 changes: 9 additions & 5 deletions common/gocryptfstools.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ def init_backend(self):
gocryptfs = [self.mountproc, '-extpass', 'backintime-askpass']
gocryptfs.append('-init')
gocryptfs.append(self.path)
logger.debug('Call command to create gocryptfs config file: %s'
%' '.join(gocryptfs),
self)
logger.debug(
'Call command to create gocryptfs config file: %s'
%' '.join(gocryptfs),
self
)

proc = subprocess.Popen(gocryptfs, env = env,
stdout = subprocess.PIPE,
Expand All @@ -93,8 +95,10 @@ def init_backend(self):
output = proc.communicate()[0]
#### self.backupConfig()
if proc.returncode:
raise MountException(_('Can\'t init encrypted path \'%(command)s\':\n\n%(error)s') \
% {'command': ' '.join(gocryptfs), 'error': output})
raise MountException(
_("Can't init encrypted path '{command}':\n\n{error}")
.format(command=' '.join(gocryptfs), error=output)
)

def preMountCheck(self, first_run = False):
"""
Expand Down

0 comments on commit cf8a23a

Please sign in to comment.