summaryrefslogtreecommitdiff
path: root/libre/mcomix/libre.patch
blob: e3f12f70376a896356abebe352ad697d556cc2ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
diff --git a/mcomix/about_dialog.py b/mcomix/about_dialog.py
index 9f956d5..10ff0be 100644
--- a/mcomix/about_dialog.py
+++ b/mcomix/about_dialog.py
@@ -27,7 +27,7 @@ class _AboutDialog(gtk.AboutDialog):
         comment = \
             _('%s is an image viewer specifically designed to handle comic books.') % \
             constants.APPNAME + u' ' + \
-            _('It reads ZIP, RAR and tar archives, as well as plain image files.')
+            _('It reads ZIP and tar archives, as well as plain image files.')
         self.set_comments(comment)
 
         license = \
diff --git a/mcomix/archive_extractor.py b/mcomix/archive_extractor.py
index afed5c7..bc969bf 100644
--- a/mcomix/archive_extractor.py
+++ b/mcomix/archive_extractor.py
@@ -12,8 +12,8 @@ class Extractor:
 
     """Extractor is a threaded class for extracting different archive formats.
 
-    The Extractor can be loaded with paths to archives (currently ZIP, tar,
-    or RAR archives) and a path to a destination directory. Once an archive
+    The Extractor can be loaded with paths to archives (currently ZIP or tar
+    archives) and a path to a destination directory. Once an archive
     has been set it is possible to filter out the files to be extracted and
     set the order in which they should be extracted. The extraction can
     then be started in a new thread in which files are extracted one by one,
diff --git a/mcomix/archive_tools.py b/mcomix/archive_tools.py
index 66c3f14..151a904 100644
--- a/mcomix/archive_tools.py
+++ b/mcomix/archive_tools.py
@@ -8,7 +8,6 @@ import tarfile
 from mcomix import constants
 from mcomix import log
 from mcomix.archive import zip
-from mcomix.archive import rar
 from mcomix.archive import tar
 from mcomix.archive import sevenzip
 from mcomix.archive import lha
@@ -16,9 +15,6 @@ from mcomix.archive import lha
 def szip_available():
     return sevenzip.SevenZipArchive.is_available()
 
-def rar_available():
-    return rar.RarArchive.is_available() or szip_available()
-
 def lha_available():
     return lha.LhaArchive.is_available() or szip_available()
 
@@ -31,9 +27,6 @@ def get_supported_archive_regex():
     if szip_available():
         formats.extend(constants.SZIP_FORMATS[1])
 
-    if rar_available():
-        formats.extend(constants.RAR_FORMATS[1])
-
     if lha_available():
         formats.extend(constants.LHA_FORMATS[1])
 
@@ -71,10 +64,7 @@ def archive_mime_type(path):
                 else:
                     return constants.TAR
 
-            if magic == 'Rar!':
-                return constants.RAR
-
-            elif magic == '7z\xBC\xAF':
+            if magic == '7z\xBC\xAF':
                 return constants.SEVENZIP
 
             elif magic[2:] == '-l':
@@ -124,11 +114,6 @@ def get_archive_handler(path):
         return zip.ZipArchive(path)
     elif mime in (constants.TAR, constants.GZIP, constants.BZIP2):
         return tar.TarArchive(path)
-    elif mime == constants.RAR and rar.RarArchive.is_available():
-        return rar.RarArchive(path)
-    elif mime == constants.RAR and sevenzip.SevenZipArchive.is_available():
-        log.info('Using Sevenzip for RAR archives.')
-        return sevenzip.SevenZipArchive(path)
     elif mime == constants.SEVENZIP and sevenzip.SevenZipArchive.is_available():
         return sevenzip.SevenZipArchive(path)
     elif mime == constants.LHA and lha.LhaArchive.is_available():
diff --git a/mcomix/constants.py b/mcomix/constants.py
index fad3b78..3c225c5 100644
--- a/mcomix/constants.py
+++ b/mcomix/constants.py
@@ -28,7 +28,7 @@ FILEINFO_PICKLE_PATH = os.path.join(DATA_DIR, 'file.pickle')
 PREFERENCE_PICKLE_PATH = os.path.join(CONFIG_DIR, 'preferences.pickle')
 
 ZOOM_MODE_BEST, ZOOM_MODE_WIDTH, ZOOM_MODE_HEIGHT, ZOOM_MODE_MANUAL, ZOOM_MODE_SIZE = range(5)
-ZIP, RAR, TAR, GZIP, BZIP2, PDF, SEVENZIP, LHA = range(8)
+ZIP, TAR, GZIP, BZIP2, PDF, SEVENZIP, LHA = range(7)
 NORMAL_CURSOR, GRAB_CURSOR, WAIT_CURSOR, NO_CURSOR = range(4)
 LIBRARY_DRAG_EXTERNAL_ID, LIBRARY_DRAG_BOOK_ID, LIBRARY_DRAG_COLLECTION_ID = range(3)
 AUTOROTATE_NEVER, AUTOROTATE_WIDTH_90, AUTOROTATE_WIDTH_270, \
@@ -57,9 +57,6 @@ SUPPORTED_IMAGE_REGEX = re.compile(r'\.(jpg|jpeg|png|gif|tif|tiff|bmp|ppm|pgm|pb
 ZIP_FORMATS = (
         ('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/x-cbz'),
         ('*.zip', '*.cbz'))
-RAR_FORMATS = (
-        ('application/x-rar', 'application/x-cbr'),
-        ('*.rar', '*.cbr'))
 TAR_FORMATS = (
         ('application/x-tar', 'application/x-gzip', 'application/x-bzip2', 'application/x-cbt'),
         ('*.tar', '*.gz', '*.bz2', '*.bzip2', '*.cbt'))
diff --git a/mcomix/file_chooser_base_dialog.py b/mcomix/file_chooser_base_dialog.py
index 4d2a34e..c518842 100644
--- a/mcomix/file_chooser_base_dialog.py
+++ b/mcomix/file_chooser_base_dialog.py
@@ -88,9 +88,6 @@ class _BaseFileChooserDialog(gtk.Dialog):
         # extractor availability.
         mimetypes = constants.ZIP_FORMATS[0] + constants.TAR_FORMATS[0]
         patterns = constants.ZIP_FORMATS[1] + constants.TAR_FORMATS[1]
-        if archive_tools.rar_available():
-            mimetypes += constants.RAR_FORMATS[0]
-            patterns += constants.RAR_FORMATS[1]
         if archive_tools.szip_available():
             mimetypes += constants.SZIP_FORMATS[0]
             patterns += constants.SZIP_FORMATS[1]
@@ -107,10 +104,6 @@ class _BaseFileChooserDialog(gtk.Dialog):
         self.add_filter(_('Tar archives'),
             *constants.TAR_FORMATS)
 
-        if archive_tools.rar_available():
-            self.add_filter(_('RAR archives'),
-                *constants.RAR_FORMATS)
-
         if archive_tools.szip_available():
             self.add_filter(_('7z archives'),
                 *constants.SZIP_FORMATS)
diff --git a/mcomix/messages/mcomix.pot b/mcomix/messages/mcomix.pot
index 54ece85..482c051 100644
--- a/mcomix/messages/mcomix.pot
+++ b/mcomix/messages/mcomix.pot
@@ -24,7 +24,7 @@ msgid "%s is an image viewer specifically designed to handle comic books."
 msgstr ""
 
 #: mcomix/about_dialog.py:30
-msgid "It reads ZIP, RAR and tar archives, as well as plain image files."
+msgid "It reads ZIP and tar archives, as well as plain image files."
 msgstr ""
 
 #: mcomix/about_dialog.py:34
@@ -241,10 +241,6 @@ msgstr ""
 msgid "Tar archives"
 msgstr ""
 
-#: mcomix/file_chooser_base_dialog.py:111
-msgid "RAR archives"
-msgstr ""
-
 #: mcomix/file_chooser_base_dialog.py:115
 msgid "7z archives"
 msgstr ""
@@ -1345,10 +1341,6 @@ msgstr ""
 msgid "Bzip2 compressed tar archive"
 msgstr ""
 
-#: mcomix/strings.py:13
-msgid "RAR archive"
-msgstr ""
-
 #: mcomix/strings.py:14
 msgid "7z archive"
 msgstr ""
diff --git a/mcomix/process.py b/mcomix/process.py
index 4ba60c6..c37699d 100644
--- a/mcomix/process.py
+++ b/mcomix/process.py
@@ -10,10 +10,7 @@ from mcomix import i18n
 class Process:
 
     """The subprocess and popen2 modules in Python are broken (see issue
-    #1336). The problem (i.e. complete crash) they can cause happen fairly
-    often (once is too often) in MComix when calling "rar" or "unrar" to
-    extract specific files from archives. We roll our own very simple
-    process spawning module here instead.
+    #1336). We roll our own very simple process spawning module here instead.
     """
     # TODO: I can no longer reproduce the issue. Check if this version of
     # process.py still solves it.
diff --git a/mcomix/recent.py b/mcomix/recent.py
index 3d4613d..3f5c511 100644
--- a/mcomix/recent.py
+++ b/mcomix/recent.py
@@ -30,8 +30,7 @@ class RecentFilesMenu(gtk.RecentChooserMenu):
         rfilter.add_pixbuf_formats()
 
         mimetypes, patterns = itertools.izip(constants.ZIP_FORMATS,
-                constants.RAR_FORMATS, constants.TAR_FORMATS,
-                constants.SZIP_FORMATS)
+                constants.TAR_FORMATS, constants.SZIP_FORMATS)
 
         for mimetype in itertools.chain.from_iterable(mimetypes):
             rfilter.add_mime_type(mimetype)
diff --git a/mcomix/strings.py b/mcomix/strings.py
index c5ca21f..cc69236 100644
--- a/mcomix/strings.py
+++ b/mcomix/strings.py
@@ -3,14 +3,13 @@
     This file should only be imported after gettext has been correctly initialized
     and installed in the global namespace. """
 
-from mcomix.constants import ZIP, TAR, GZIP, BZIP2, RAR, SEVENZIP, LHA
+from mcomix.constants import ZIP, TAR, GZIP, BZIP2, SEVENZIP, LHA
 
 ARCHIVE_DESCRIPTIONS = {
                         ZIP:   _('ZIP archive'),
                         TAR:   _('Tar archive'),
                         GZIP:  _('Gzip compressed tar archive'),
                         BZIP2: _('Bzip2 compressed tar archive'),
-                        RAR:   _('RAR archive'),
                         SEVENZIP: _('7z archive'),
                         LHA: _('LHA archive')
                        }
diff --git a/mcomix.egg-info/SOURCES.txt b/mcomix.egg-info/SOURCES.txt
index 62de3ad..85a65df 100644
--- a/mcomix.egg-info/SOURCES.txt
+++ b/mcomix.egg-info/SOURCES.txt
@@ -77,8 +77,6 @@ mcomix.egg-info/top_level.txt
 mcomix/archive/__init__.py
 mcomix/archive/archive_base.py
 mcomix/archive/lha.py
-mcomix/archive/rar.py
-mcomix/archive/rarfile.py
 mcomix/archive/sevenzip.py
 mcomix/archive/tar.py
 mcomix/archive/zip.py
@@ -183,18 +181,13 @@ mime/comicthumb.1.gz
 mime/mcomix.desktop
 mime/mcomix.thumbnailer
 mime/mcomix.xml
-mime/icons/16x16/application-x-cbr.png
 mime/icons/16x16/application-x-cbt.png
 mime/icons/16x16/application-x-cbz.png
-mime/icons/22x22/application-x-cbr.png
 mime/icons/22x22/application-x-cbt.png
 mime/icons/22x22/application-x-cbz.png
-mime/icons/24x24/application-x-cbr.png
 mime/icons/24x24/application-x-cbt.png
 mime/icons/24x24/application-x-cbz.png
-mime/icons/32x32/application-x-cbr.png
 mime/icons/32x32/application-x-cbt.png
 mime/icons/32x32/application-x-cbz.png
-mime/icons/48x48/application-x-cbr.png
 mime/icons/48x48/application-x-cbt.png
-mime/icons/48x48/application-x-cbz.png
\ No newline at end of file
+mime/icons/48x48/application-x-cbz.png
diff --git a/mime/comicbook.schemas b/mime/comicbook.schemas
index cdc4a4a..21b6214 100644
--- a/mime/comicbook.schemas
+++ b/mime/comicbook.schemas
@@ -1,28 +1,6 @@
 <gconfschemafile>
     <schemalist>
         <schema>
-            <key>/schemas/desktop/gnome/thumbnailers/application@x-cbr/enable</key>
-            <applyto>/desktop/gnome/thumbnailers/application@x-cbr/enable</applyto>
-            <owner>comicthumb</owner>
-            <type>bool</type>
-            <default>true</default>
-            <locale name="C">
-                <short></short>
-                <long></long>
-            </locale>
-        </schema>
-        <schema>
-            <key>/schemas/desktop/gnome/thumbnailers/application@x-cbr/command</key>
-            <applyto>/desktop/gnome/thumbnailers/application@x-cbr/command</applyto>
-            <owner>comicthumb</owner>
-            <type>string</type>
-            <default>comicthumb %i %o %s</default>
-            <locale name="C">
-                <short></short>
-                <long></long>
-            </locale>
-        </schema>
-        <schema>
             <key>/schemas/desktop/gnome/thumbnailers/application@x-cbz/enable</key>
             <applyto>/desktop/gnome/thumbnailers/application@x-cbz/enable</applyto>
             <owner>comicthumb</owner>
diff --git a/mime/comicthumb b/mime/comicthumb
index 5728e2a..d77a4a1 100755
--- a/mime/comicthumb
+++ b/mime/comicthumb
@@ -7,7 +7,7 @@ comicthumb is dependent on the Python Imaging Library (PIL).
 comicthumb was originally written by Christoph Wolk, this version was
 re-written from scratch for Comix 4 by Pontus Ekberg. 
 
-Supported formats: ZIP, RAR and tar (.cbz, .cbr, .cbt)
+Supported formats: ZIP and tar (.cbz, .cbt)
 
 Usage: comicthumb INFILE OUTFILE [SIZE]
 """
@@ -28,16 +28,13 @@ except ImportError:
     print __doc__
     sys.exit(1)
 
-ZIP, RAR, TAR, GZIP, BZIP2 = range(5)
+ZIP, TAR, GZIP, BZIP2 = range(5)
 
 
 class Process:
     
     """The subprocess and popen2 modules in Python are broken (see issue
-    #1336). The problem (i.e. complete crash) they can cause happen fairly
-    often (once is too often) in Comix when calling "rar" or "unrar" to
-    extract specific files from archives. We roll our own very simple
-    process spawning module here instead.
+    #1336). We roll our own very simple process spawning module here instead.
     """
     # TODO: I can no longer reproduce the issue. Check if this version of
     # process.py still solves it.
@@ -94,19 +91,6 @@ class Extractor:
         elif self._type in [TAR, GZIP, BZIP2]:
             self._tfile = tarfile.open(src, 'r')
             self._files = self._tfile.getnames()
-        elif self._type == RAR:
-            self._rar = None
-            for command in ('unrar', 'rar'):
-                if Process([command]).spawn() is not None:
-                    self._rar = command
-            if self._rar == None:
-                print '! Could not find the "rar" or "unrar" executable.'
-                sys.exit(1)
-            proc = Process([self._rar, 'vb', src])
-            fobj = proc.spawn()
-            self._files = fobj.readlines()
-            proc.wait()
-            self._files = [name.rstrip('\n') for name in self._files]
     
     def get_files(self):
         """Return a list of the files in the archive."""
@@ -121,11 +105,6 @@ class Extractor:
             return cStringIO.StringIO(self._zfile.read(chosen))
         elif self._type in [TAR, GZIP, BZIP2]:
             return cStringIO.StringIO(self._tfile.extractfile(chosen).read())
-        elif self._type == RAR:
-            proc = Process([self._rar, 'p', '-inul', '-p-', '--',
-                self._src, chosen])
-            fobj = proc.spawn()
-            return cStringIO.StringIO(fobj.read())
 
 
 def archive_mime_type(path):
@@ -145,8 +124,6 @@ def archive_mime_type(path):
                 if magic.startswith('\037\213'):
                     return GZIP
                 return TAR
-            if magic == 'Rar!':
-                return RAR
     except Exception:
         print '! Error while reading', path
     return None
diff --git a/mime/mcomix.desktop b/mime/mcomix.desktop
index ee6d8b9..19ec7cd 100644
--- a/mime/mcomix.desktop
+++ b/mime/mcomix.desktop
@@ -19,4 +19,4 @@ Terminal=false
 Type=Application
 StartupNotify=true
 Categories=Graphics;Viewer;
-MimeType=application/x-cbz;application/x-cbr;application/x-cbt;image/jpeg;image/png;image/gif;image/tiff;image/bmp;image/x-icon;image/x-xpixmap;image/x-xbitmap;application/x-zip;application/zip;application/x-rar;application/x-tar;application/x-gzip;application/x-bzip2;image/svg+xml;image/svg;image/svg-xml;image/vnd.adobe.svg+xml;text/xml-svg;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-pcx;image/x-cmu-raster;image/x-sun-raster;image/x-tga;application/x-7z-compressed;application/x-cb7;application/x-lzh;application/x-lha;application/x-lzh-compressed;
+MimeType=application/x-cbz;application/x-cbt;image/jpeg;image/png;image/gif;image/tiff;image/bmp;image/x-icon;image/x-xpixmap;image/x-xbitmap;application/x-zip;application/zip;application/x-tar;application/x-gzip;application/x-bzip2;image/svg+xml;image/svg;image/svg-xml;image/vnd.adobe.svg+xml;text/xml-svg;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-pcx;image/x-cmu-raster;image/x-sun-raster;image/x-tga;application/x-7z-compressed;application/x-cb7;application/x-lzh;application/x-lha;application/x-lzh-compressed;
diff --git a/mime/mcomix.thumbnailer b/mime/mcomix.thumbnailer
index 4dcfc67..667dc8b 100644
--- a/mime/mcomix.thumbnailer
+++ b/mime/mcomix.thumbnailer
@@ -1,4 +1,4 @@
 [Thumbnailer Entry]
 TryExec=comicthumb
 Exec=comicthumb %u %o %s
-MimeType=application/x-cbr;application/x-cbz;application/x-cbt;
+MimeType=application/x-cbz;application/x-cbt;
diff --git a/mime/mcomix.xml b/mime/mcomix.xml
index 765c254..b13e2da 100644
--- a/mime/mcomix.xml
+++ b/mime/mcomix.xml
@@ -5,11 +5,6 @@
         <comment xml:lang="en">Comic Book Archive (Zip compressed)</comment>
         <glob pattern="*.cbz"/>
     </mime-type>
-    <mime-type type="application/x-cbr">
-        <sub-class-of type="application/x-rar"/>
-        <comment xml:lang="en">Comic Book Archive (RAR compressed)</comment>
-        <glob pattern="*.cbr"/> 
-    </mime-type>
     <mime-type type="application/x-cbt">
         <sub-class-of type="application/x-compressed-tar"/>
         <sub-class-of type="application/x-bzip-compressed-tar"/>
diff --git a/setup.py b/setup.py
index 9eb7782..9979111 100755
--- a/setup.py
+++ b/setup.py
@@ -78,23 +78,18 @@ setuptools.setup(
         ('share/icons/hicolor/48x48/apps', ['mcomix/images/48x48/mcomix.png']),
         ('share/icons/hicolor/16x16/mimetypes',
             ['mime/icons/16x16/application-x-cbz.png',
-             'mime/icons/16x16/application-x-cbr.png',
              'mime/icons/16x16/application-x-cbt.png']),
         ('share/icons/hicolor/22x22/mimetypes',
             ['mime/icons/22x22/application-x-cbz.png',
-             'mime/icons/22x22/application-x-cbr.png',
              'mime/icons/22x22/application-x-cbt.png']),
         ('share/icons/hicolor/24x24/mimetypes',
             ['mime/icons/24x24/application-x-cbz.png',
-             'mime/icons/24x24/application-x-cbr.png',
              'mime/icons/24x24/application-x-cbt.png']),
         ('share/icons/hicolor/32x32/mimetypes',
             ['mime/icons/32x32/application-x-cbz.png',
-             'mime/icons/32x32/application-x-cbr.png',
              'mime/icons/32x32/application-x-cbt.png']),
         ('share/icons/hicolor/48x48/mimetypes',
             ['mime/icons/48x48/application-x-cbz.png',
-             'mime/icons/48x48/application-x-cbr.png',
              'mime/icons/48x48/application-x-cbt.png'])],
 
     # Package metadata