Merge lp:~flexiondotorg/deja-dup-caja/bug-fixes into lp:deja-dup-caja

Proposed by Martin Wimpress 
Status: Merged
Merged at revision: 23
Proposed branch: lp:~flexiondotorg/deja-dup-caja/bug-fixes
Merge into: lp:deja-dup-caja
Diff against target: 272 lines (+50/-54)
3 files modified
README (+14/-10)
caja-extension/dejadup.py (+31/-38)
setup.py (+5/-6)
To merge this branch: bzr merge lp:~flexiondotorg/deja-dup-caja/bug-fixes
Reviewer Review Type Date Requested Status
costales Pending
Review via email: mp+400693@code.launchpad.net

Commit message

This merge proposal fixes several bugs.

 * Bump version to 0.0.9 (LP: #1868124)
 * Make Python 3 compatible. (LP: #1863498)
 * Drop Restore Missing, no longer a feature of deja-dup. (LP: #1885063)

To post a comment you must log in.
Revision history for this message
costales (costales) wrote :

Thanks Martin!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'README'
--- README 2019-06-02 07:07:30 +0000
+++ README 2021-04-07 10:32:33 +0000
@@ -1,26 +1,30 @@
1Deja Dup Caja © 2015-2019 Marcos Alvarez Costales1Deja Dup Caja © 2015-2019 Marcos Alvarez Costales
2============================================2=================================================
33
4WHAT IS IT?4WHAT IS IT?
5===========5===========
6A Caja extension for backup/restore files/folders in an easy way from a contextual menu.6A Caja extension to backup/restore files/folders in an easy way from a contextual menu.
7
87
98
10HOW DO I INSTALL & RUN IT?9HOW DO I INSTALL & RUN IT?
11==========================10==========================
12From a PPA:11
13 # add-apt-repository ppa:costales/deja-dup-caja12For Ubuntu
14 # apt-get update && sudo apt-get install deja-dup-caja13
15From the code (take a look to the dependencies):14 $ sudo apt install deja-dup-caja
16 $ bzr branch lp:deja-dup-caja && cd deja-dup-caja && sudo python setup.py install --prefix=/usr15
16From source (see dependencies below)
17
18 $ bzr branch lp:deja-dup-caja
19 $ cd deja-dup-caja
20 $ sudo python3 setup.py install --prefix=/usr
1721
18Then, restart Caja22Then, restart Caja
23
19 $ caja -q24 $ caja -q
2025
2126
22
23DEPENDENCIES27DEPENDENCIES
24============28============
25For Caja:29For Caja:
26 python-caja, caja, gir1.2-caja, libgtk2.0-bin30 caja, deja-dup, gir1.2-caja-2.0, gir1.2-gtk-3.0, python3-caja
2731
=== modified file 'caja-extension/dejadup.py'
--- caja-extension/dejadup.py 2019-06-03 16:47:16 +0000
+++ caja-extension/dejadup.py 2021-04-07 10:32:33 +0000
@@ -1,5 +1,5 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2# Deja Dup Caja 0.0.82# Deja Dup Caja 0.0.9
3# Copyright (C) 2015-2019 Marcos Alvarez Costales https://launchpad.net/~costales3# Copyright (C) 2015-2019 Marcos Alvarez Costales https://launchpad.net/~costales
4# Copyright (C) 2015 Ubuntu MATE Project https://ubuntu-mate.org/4# Copyright (C) 2015 Ubuntu MATE Project https://ubuntu-mate.org/
5#5#
@@ -7,12 +7,12 @@
7# it under the terms of the GNU General Public License as published by7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 3 of the License, or8# the Free Software Foundation; either version 3 of the License, or
9# (at your option) any later version.9# (at your option) any later version.
10# 10#
11# Deja Dup Caja is distributed in the hope that it will be useful,11# Deja Dup Caja is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.14# GNU General Public License for more details.
15# 15#
16# You should have received a copy of the GNU General Public License16# You should have received a copy of the GNU General Public License
17# along with Deja Dup Caja; if not, see http://www.gnu.org/licenses17# along with Deja Dup Caja; if not, see http://www.gnu.org/licenses
18# for more information.18# for more information.
@@ -34,7 +34,7 @@
34class DejaDup:34class DejaDup:
35 def __init__(self):35 def __init__(self):
36 pass36 pass
37 37
38 def _run_cmd(self, cmd, background=True):38 def _run_cmd(self, cmd, background=True):
39 """Run command into shell"""39 """Run command into shell"""
40 if background:40 if background:
@@ -43,44 +43,41 @@
43 proc = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)43 proc = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
44 stdout,stderr = proc.communicate()44 stdout,stderr = proc.communicate()
45 return stdout,stderr45 return stdout,stderr
46 46
47 def backup(self, item):47 def backup(self, item):
48 """Call to backup"""48 """Call to backup"""
49 self._run_cmd(['deja-dup', '--backup', item])49 self._run_cmd(['deja-dup', '--backup', item])
50 50
51 def restore(self, item):51 def restore(self, item):
52 """Call to restore"""52 """Call to restore"""
53 self._run_cmd(['deja-dup', '--restore', item])53 self._run_cmd(['deja-dup', '--restore', item])
54 54
55 def restore_missing(self, item):
56 """Call to restore"""
57 self._run_cmd(['deja-dup', '--restore-missing', item])
58
59 def get_dejadup_paths(self, type_list):55 def get_dejadup_paths(self, type_list):
60 """Get include/exclude paths from Deja Dup"""56 """Get include/exclude paths from Deja Dup"""
61 new_paths = []57 new_paths = []
62 58
63 cmd = ['gsettings', 'get', 'org.gnome.DejaDup', type_list]59 cmd = ['gsettings', 'get', 'org.gnome.DejaDup', type_list]
64 stdout,stderr = self._run_cmd(cmd, False)60 stdout,stderr = self._run_cmd(cmd, False)
65 61
66 # Error62 # Error
67 if stderr:63 if stderr:
68 return []64 return []
69 # OK65 # OK
70 paths = ast.literal_eval([stdout][0]) # Convert shell dump to list66 stdout_str = [stdout][0].decode() # With python3 needs this convertion
67 paths = ast.literal_eval(stdout_str) # Convert shell dump to list
71 for path in paths:68 for path in paths:
72 try: # Is a shell variable?69 try: # Is a shell variable?
73 new_paths.append(os.environ[path.replace('$', '')])70 new_paths.append(os.environ[path.replace('$', '')])
74 except:71 except:
75 new_paths.append(path)72 new_paths.append(path)
76 73
77 return new_paths74 return new_paths
7875
7976
80class Utils:77class Utils:
81 def __init__(self):78 def __init__(self):
82 pass79 pass
83 80
84 def get_filepath(self, items):81 def get_filepath(self, items):
85 """Get just the path from a complete path and filename"""82 """Get just the path from a complete path and filename"""
86 try:83 try:
@@ -88,7 +85,7 @@
88 except:85 except:
89 item = items86 item = items
90 return unquote(item.get_uri()[7:])87 return unquote(item.get_uri()[7:])
91 88
92 def search_paths(self, item_path, paths):89 def search_paths(self, item_path, paths):
93 """Check if at least one path is in the pattern path"""90 """Check if at least one path is in the pattern path"""
94 for path in paths:91 for path in paths:
@@ -101,61 +98,57 @@
101 def __init__(self):98 def __init__(self):
102 self.dejadup = DejaDup()99 self.dejadup = DejaDup()
103 self.utils = Utils()100 self.utils = Utils()
104 101
105 def _backup_activate(self, menu, item):102 def _backup_activate(self, menu, item):
106 """Backup file or folder"""103 """Backup file or folder"""
107 self.dejadup.backup(item)104 self.dejadup.backup(item)
108 105
109 def _restore_activate(self, menu, item):106 def _restore_activate(self, menu, item):
110 """Restore file or folder"""107 """Restore file or folder"""
111 self.dejadup.restore(item)108 self.dejadup.restore(item)
112 109
113 def _missing_activate(self, menu, item):
114 """Missing items"""
115 self.dejadup.restore_missing(item)
116
117 def _previous_checks(self, items):110 def _previous_checks(self, items):
118 """Checks before generate the contextual menu"""111 """Checks before generate the contextual menu"""
119 # Show only for 1 item selected112 # Show only for 1 item selected
120 if len(items) != 1:113 if len(items) != 1:
121 return False114 return False
122 item = items[0]115 item = items[0]
123 116
124 # Check exists yet117 # Check exists yet
125 if item.is_gone():118 if item.is_gone():
126 return False119 return False
127 120
128 # Only handle files121 # Only handle files
129 if item.get_uri_scheme() != 'file':122 if item.get_uri_scheme() != 'file':
130 return False123 return False
131 124
132 return True125 return True
133 126
134 def get_background_items(self, window, current_folder):127 def get_background_items(self, window, current_folder):
135 """Caja invoke this when user clicks in an empty area"""128 """Caja invoke this when user clicks in an empty area"""
136 Menu = Caja.MenuItem(129 Menu = Caja.MenuItem(
137 name="DejaDupCajaMenu::Missing",130 name="DejaDupCajaMenu::Restore",
138 label=_("Restore Missing Files..."),131 label=_("Revert to Previous Version..."),
139 icon="deja-dup")132 icon="deja-dup")
140 133
141 # Get complete path134 # Get complete path
142 item = self.utils.get_filepath(current_folder)135 item = self.utils.get_filepath(current_folder)
143 136
144 Menu.connect('activate', self._missing_activate, item)137 Menu.connect('activate', self._restore_activate, item)
145 return [Menu]138 return [Menu]
146 139
147 def get_file_items(self, window, selected_items):140 def get_file_items(self, window, selected_items):
148 """Caja invoke this when user clicks in a file or folder"""141 """Caja invoke this when user clicks in a file or folder"""
149 if not self._previous_checks(selected_items):142 if not self._previous_checks(selected_items):
150 return143 return
151 144
152 # Get complete path145 # Get complete path
153 item = self.utils.get_filepath(selected_items)146 item = self.utils.get_filepath(selected_items)
154 147
155 # Get paths148 # Get paths
156 include_paths = self.dejadup.get_dejadup_paths('include-list')149 include_paths = self.dejadup.get_dejadup_paths('include-list')
157 exclude_paths = self.dejadup.get_dejadup_paths('exclude-list')150 exclude_paths = self.dejadup.get_dejadup_paths('exclude-list')
158 151
159 # Check backup or restore menu entry152 # Check backup or restore menu entry
160 # Is the path into the exclude? > Backup153 # Is the path into the exclude? > Backup
161 if self.utils.search_paths(item, exclude_paths):154 if self.utils.search_paths(item, exclude_paths):
@@ -166,7 +159,7 @@
166 # Not include/exclude > Backup159 # Not include/exclude > Backup
167 else:160 else:
168 backup = True161 backup = True
169 162
170 # Generate menu and trigger event163 # Generate menu and trigger event
171 if backup:164 if backup:
172 Menu = Caja.MenuItem(165 Menu = Caja.MenuItem(
173166
=== modified file 'setup.py'
--- setup.py 2019-06-03 16:47:16 +0000
+++ setup.py 2021-04-07 10:32:33 +0000
@@ -1,6 +1,6 @@
1#!/usr/bin/env python1#!/usr/bin/env python
22
3# Deja Dup Caja 0.0.8 - http://launchpad.net/deja-dup-caja3# Deja Dup Caja 0.0.9 - http://launchpad.net/deja-dup-caja
4# Copyright (C) 2015-2019 Marcos Alvarez Costales https://launchpad.net/~costales4# Copyright (C) 2015-2019 Marcos Alvarez Costales https://launchpad.net/~costales
5# Copyright (C) 2015 Ubuntu MATE https://ubuntu-mate.org/5# Copyright (C) 2015 Ubuntu MATE https://ubuntu-mate.org/
6#6#
@@ -8,14 +8,14 @@
8# it under the terms of the GNU General Public License as published by8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 3 of the License, or9# the Free Software Foundation; either version 3 of the License, or
10# (at your option) any later version.10# (at your option) any later version.
11# 11#
12# Deja Dup Caja is distributed in the hope that it will be useful,12# Deja Dup Caja is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.15# GNU General Public License for more details.
16# 16#
17# You should have received a copy of the GNU General Public License17# You should have received a copy of the GNU General Public License
18# along with Deja Dup Caja; if not, see http://www.gnu.org/licenses 18# along with Deja Dup Caja; if not, see http://www.gnu.org/licenses
19# for more information.19# for more information.
2020
2121
@@ -27,12 +27,11 @@
27# Setup stage27# Setup stage
28DistUtilsExtra.auto.setup(28DistUtilsExtra.auto.setup(
29 name = "deja-dup-caja",29 name = "deja-dup-caja",
30 version = "0.0.6",30 version = "0.0.9",
31 description = "Backup/Restore your files from Caja File Browser",31 description = "Backup/Restore your files from Caja File Browser",
32 author = "Marcos Alvarez Costales https://launchpad.net/~costales",32 author = "Marcos Alvarez Costales https://launchpad.net/~costales",
33 author_email = "https://launchpad.net/~costales",33 author_email = "https://launchpad.net/~costales",
34 url = "https://launchpad.net/deja-dup-caja",34 url = "https://launchpad.net/deja-dup-caja",
35 license = "GPL3",35 license = "GPL3",
36 data_files = data
37 )36 )
3837

Subscribers

People subscribed via source and target branches