summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2014-06-08 13:39:18 +0200
committerjvoisin2014-06-08 13:39:18 +0200
commitaf36529554c39a2eefcc2c8723715e2d25b401b8 (patch)
treef54b964520bab44d1dfac725086211eaf22d3763
parentef5a32cfd3c0555ffe5ddf413eeaae61622ebb4b (diff)
Rename the MAT folder to libmat.
This commit fixes some issues for dump operating systems who doesn't handle capitalization.
-rw-r--r--MANIFEST.in2
-rw-r--r--RELEASE4
-rw-r--r--libmat/__init__.py (renamed from MAT/__init__.py)0
-rw-r--r--libmat/archive.py (renamed from MAT/archive.py)0
-rw-r--r--libmat/audio.py (renamed from MAT/audio.py)0
-rw-r--r--libmat/bencode/__init__.py (renamed from MAT/bencode/__init__.py)0
-rw-r--r--libmat/bencode/bencode.py (renamed from MAT/bencode/bencode.py)0
-rw-r--r--libmat/exceptions.py (renamed from MAT/exceptions.py)0
-rw-r--r--libmat/exiftool.py (renamed from MAT/exiftool.py)0
-rw-r--r--libmat/hachoir_editor/__init__.py (renamed from MAT/hachoir_editor/__init__.py)0
-rw-r--r--libmat/hachoir_editor/field.py (renamed from MAT/hachoir_editor/field.py)0
-rw-r--r--libmat/hachoir_editor/fieldset.py (renamed from MAT/hachoir_editor/fieldset.py)0
-rw-r--r--libmat/hachoir_editor/typed_field.py (renamed from MAT/hachoir_editor/typed_field.py)0
-rw-r--r--libmat/images.py (renamed from MAT/images.py)0
-rw-r--r--libmat/mat.py (renamed from MAT/mat.py)6
-rw-r--r--libmat/misc.py (renamed from MAT/misc.py)0
-rw-r--r--libmat/mutagenstripper.py (renamed from MAT/mutagenstripper.py)0
-rw-r--r--libmat/office.py (renamed from MAT/office.py)0
-rw-r--r--libmat/parser.py (renamed from MAT/parser.py)0
-rw-r--r--libmat/strippers.py (renamed from MAT/strippers.py)0
-rwxr-xr-xmat6
-rwxr-xr-xmat-gui8
-rw-r--r--nautilus/nautilus-mat.py8
-rwxr-xr-xsetup.py2
-rw-r--r--test/clitest.py2
-rw-r--r--test/libtest.py44
26 files changed, 41 insertions, 41 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index 57c97d0..fb0af66 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -2,7 +2,7 @@ include README README.security LICENSE mat mat-gui
2include TODO mat.desktop 2include TODO mat.desktop
3include mat.1 mat-gui.1 3include mat.1 mat-gui.1
4recursive-include data * 4recursive-include data *
5recursive-include MAT *.py 5recursive-include libmat *.py
6recursive-include test *.py clean.* dirty.* 6recursive-include test *.py clean.* dirty.*
7recursive-include po * 7recursive-include po *
8recursive-include nautilus *.py 8recursive-include nautilus *.py
diff --git a/RELEASE b/RELEASE
index 3a34cd7..99e6fcf 100644
--- a/RELEASE
+++ b/RELEASE
@@ -9,10 +9,10 @@ update changelog:
9 git log -> CHANGELOG 9 git log -> CHANGELOG
10 10
11update version number (Don't be affraid to use -rc or -beta) 11update version number (Don't be affraid to use -rc or -beta)
12 MAT/mat.py -> __version__ = $VERSION 12 libmat/mat.py -> __version__ = $VERSION
13 13
14commit release changes 14commit release changes
15 git commit CHANGELOG MAT/mat.py 15 git commit CHANGELOG libmat/mat.py
16 16
17create a tag 17create a tag
18 git tag -s $VERSION 18 git tag -s $VERSION
diff --git a/MAT/__init__.py b/libmat/__init__.py
index 8b13789..8b13789 100644
--- a/MAT/__init__.py
+++ b/libmat/__init__.py
diff --git a/MAT/archive.py b/libmat/archive.py
index d483dcc..d483dcc 100644
--- a/MAT/archive.py
+++ b/libmat/archive.py
diff --git a/MAT/audio.py b/libmat/audio.py
index dae9d75..dae9d75 100644
--- a/MAT/audio.py
+++ b/libmat/audio.py
diff --git a/MAT/bencode/__init__.py b/libmat/bencode/__init__.py
index 8b13789..8b13789 100644
--- a/MAT/bencode/__init__.py
+++ b/libmat/bencode/__init__.py
diff --git a/MAT/bencode/bencode.py b/libmat/bencode/bencode.py
index a0cc99a..a0cc99a 100644
--- a/MAT/bencode/bencode.py
+++ b/libmat/bencode/bencode.py
diff --git a/MAT/exceptions.py b/libmat/exceptions.py
index 47da15c..47da15c 100644
--- a/MAT/exceptions.py
+++ b/libmat/exceptions.py
diff --git a/MAT/exiftool.py b/libmat/exiftool.py
index 9e38f04..9e38f04 100644
--- a/MAT/exiftool.py
+++ b/libmat/exiftool.py
diff --git a/MAT/hachoir_editor/__init__.py b/libmat/hachoir_editor/__init__.py
index 1835676..1835676 100644
--- a/MAT/hachoir_editor/__init__.py
+++ b/libmat/hachoir_editor/__init__.py
diff --git a/MAT/hachoir_editor/field.py b/libmat/hachoir_editor/field.py
index 6b1efe3..6b1efe3 100644
--- a/MAT/hachoir_editor/field.py
+++ b/libmat/hachoir_editor/field.py
diff --git a/MAT/hachoir_editor/fieldset.py b/libmat/hachoir_editor/fieldset.py
index b7c9b07..b7c9b07 100644
--- a/MAT/hachoir_editor/fieldset.py
+++ b/libmat/hachoir_editor/fieldset.py
diff --git a/MAT/hachoir_editor/typed_field.py b/libmat/hachoir_editor/typed_field.py
index 0f0427b..0f0427b 100644
--- a/MAT/hachoir_editor/typed_field.py
+++ b/libmat/hachoir_editor/typed_field.py
diff --git a/MAT/images.py b/libmat/images.py
index 67c710f..67c710f 100644
--- a/MAT/images.py
+++ b/libmat/images.py
diff --git a/MAT/mat.py b/libmat/mat.py
index 5b1fbda..8dfc2dc 100644
--- a/MAT/mat.py
+++ b/libmat/mat.py
@@ -12,7 +12,7 @@ import xml.sax
12import hachoir_core.cmd_line 12import hachoir_core.cmd_line
13import hachoir_parser 13import hachoir_parser
14 14
15import MAT.exceptions 15import libmat.exceptions
16 16
17__version__ = '0.5.2' 17__version__ = '0.5.2'
18__author__ = 'jvoisin' 18__author__ = 'jvoisin'
@@ -117,7 +117,7 @@ def secure_remove(filename):
117 os.chmod(filename, 220) 117 os.chmod(filename, 220)
118 except OSError: 118 except OSError:
119 logging.error('Unable to add write rights to %s' % filename) 119 logging.error('Unable to add write rights to %s' % filename)
120 raise MAT.exceptions.UnableToWriteFile 120 raise libmat.exceptions.UnableToWriteFile
121 121
122 try: 122 try:
123 if not subprocess.call(['shred', '--remove', filename]): 123 if not subprocess.call(['shred', '--remove', filename]):
@@ -131,7 +131,7 @@ def secure_remove(filename):
131 os.remove(filename) 131 os.remove(filename)
132 except OSError: 132 except OSError:
133 logging.error('Unable to remove %s' % filename) 133 logging.error('Unable to remove %s' % filename)
134 raise MAT.exceptions.UnableToRemoveFile 134 raise libmat.exceptions.UnableToRemoveFile
135 135
136 return True 136 return True
137 137
diff --git a/MAT/misc.py b/libmat/misc.py
index 450f381..450f381 100644
--- a/MAT/misc.py
+++ b/libmat/misc.py
diff --git a/MAT/mutagenstripper.py b/libmat/mutagenstripper.py
index 403c9a7..403c9a7 100644
--- a/MAT/mutagenstripper.py
+++ b/libmat/mutagenstripper.py
diff --git a/MAT/office.py b/libmat/office.py
index 0ca1ff1..0ca1ff1 100644
--- a/MAT/office.py
+++ b/libmat/office.py
diff --git a/MAT/parser.py b/libmat/parser.py
index 1765da8..1765da8 100644
--- a/MAT/parser.py
+++ b/libmat/parser.py
diff --git a/MAT/strippers.py b/libmat/strippers.py
index aea98da..aea98da 100644
--- a/MAT/strippers.py
+++ b/libmat/strippers.py
diff --git a/mat b/mat
index d1a2f06..03a7367 100755
--- a/mat
+++ b/mat
@@ -10,9 +10,9 @@ import os
10 10
11import hachoir_core 11import hachoir_core
12 12
13from MAT import mat 13from libmat import mat
14from MAT import strippers 14from libmat import strippers
15from MAT import archive 15from libmat import archive
16 16
17 17
18def parse(): 18def parse():
diff --git a/mat-gui b/mat-gui
index 96c9e53..5de5865 100755
--- a/mat-gui
+++ b/mat-gui
@@ -13,10 +13,10 @@ import sys
13import xml.sax 13import xml.sax
14import urllib2 14import urllib2
15 15
16from MAT import mat 16from libmat import mat
17from MAT import strippers 17from libmat import strippers
18from MAT import parser 18from libmat import parser
19from MAT import archive 19from libmat import archive
20 20
21logging.basicConfig(level=mat.LOGGING_LEVEL) 21logging.basicConfig(level=mat.LOGGING_LEVEL)
22 22
diff --git a/nautilus/nautilus-mat.py b/nautilus/nautilus-mat.py
index 19b601e..f270ed8 100644
--- a/nautilus/nautilus-mat.py
+++ b/nautilus/nautilus-mat.py
@@ -16,8 +16,8 @@ except:
16 16
17from gi.repository import Nautilus, GObject, Gtk 17from gi.repository import Nautilus, GObject, Gtk
18 18
19import MAT.mat 19import libmat.mat
20import MAT.strippers 20import libmat.strippers
21 21
22 22
23class MatExtension(GObject.GObject, Nautilus.MenuProvider): 23class MatExtension(GObject.GObject, Nautilus.MenuProvider):
@@ -33,7 +33,7 @@ class MatExtension(GObject.GObject, Nautilus.MenuProvider):
33 33
34 # We're only going to put ourselves on supported mimetypes' context menus 34 # We're only going to put ourselves on supported mimetypes' context menus
35 if not (file.get_mime_type() 35 if not (file.get_mime_type()
36 in [i["mimetype"] for i in MAT.mat.list_supported_formats()]): 36 in [i["mimetype"] for i in libmat.mat.list_supported_formats()]):
37 logging.debug("%s is not supported by MAT" % file.get_mime_type()) 37 logging.debug("%s is not supported by MAT" % file.get_mime_type())
38 return 38 return
39 39
@@ -70,7 +70,7 @@ class MatExtension(GObject.GObject, Nautilus.MenuProvider):
70 70
71 file_path = urllib.unquote(file.get_uri()[7:]) 71 file_path = urllib.unquote(file.get_uri()[7:])
72 72
73 class_file = MAT.mat.create_class_file(file_path, 73 class_file = libmat.mat.create_class_file(file_path,
74 backup=True, 74 backup=True,
75 add2archive=False) 75 add2archive=False)
76 if class_file: 76 if class_file:
diff --git a/setup.py b/setup.py
index 61a602e..6694d44 100755
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@ setup(
23 platforms = 'linux', 23 platforms = 'linux',
24 license = 'GPLv2', 24 license = 'GPLv2',
25 url = 'https://mat.boum.org', 25 url = 'https://mat.boum.org',
26 packages = ['MAT', 'MAT.hachoir_editor', 'MAT.bencode'], 26 packages = ['libmat', 'libmat.hachoir_editor', 'libmat.bencode'],
27 scripts = ['mat', 'mat-gui'], 27 scripts = ['mat', 'mat-gui'],
28 data_files = [ 28 data_files = [
29 ( 'share/applications', ['mat.desktop'] ), 29 ( 'share/applications', ['mat.desktop'] ),
diff --git a/test/clitest.py b/test/clitest.py
index ad895f5..13d545a 100644
--- a/test/clitest.py
+++ b/test/clitest.py
@@ -12,7 +12,7 @@ import sys
12import tarfile 12import tarfile
13 13
14sys.path.append('..') 14sys.path.append('..')
15from MAT import mat 15from libmat import mat
16import test 16import test
17 17
18 18
diff --git a/test/libtest.py b/test/libtest.py
index fdef091..1b25f86 100644
--- a/test/libtest.py
+++ b/test/libtest.py
@@ -14,7 +14,7 @@ import test
14import unittest 14import unittest
15 15
16sys.path.append('..') 16sys.path.append('..')
17import MAT 17import libmat
18 18
19 19
20class TestRemovelib(test.MATTest): 20class TestRemovelib(test.MATTest):
@@ -23,17 +23,17 @@ class TestRemovelib(test.MATTest):
23 def test_remove(self): 23 def test_remove(self):
24 '''make sure that the lib remove all compromizing meta''' 24 '''make sure that the lib remove all compromizing meta'''
25 for _, dirty in self.file_list: 25 for _, dirty in self.file_list:
26 current_file = MAT.mat.create_class_file(dirty, False, add2archive=True) 26 current_file = libmat.mat.create_class_file(dirty, False, add2archive=True)
27 current_file.remove_all() 27 current_file.remove_all()
28 current_file = MAT.mat.create_class_file(dirty, False, add2archive=True) 28 current_file = libmat.mat.create_class_file(dirty, False, add2archive=True)
29 self.assertTrue(current_file.is_clean()) 29 self.assertTrue(current_file.is_clean())
30 30
31 def test_remove_empty(self): 31 def test_remove_empty(self):
32 '''Test removal with clean files''' 32 '''Test removal with clean files'''
33 for clean, _ in self.file_list: 33 for clean, _ in self.file_list:
34 current_file = MAT.mat.create_class_file(clean, False, add2archive=True) 34 current_file = libmat.mat.create_class_file(clean, False, add2archive=True)
35 current_file.remove_all() 35 current_file.remove_all()
36 current_file = MAT.mat.create_class_file(clean, False, add2archive=True) 36 current_file = libmat.mat.create_class_file(clean, False, add2archive=True)
37 self.assertTrue(current_file.is_clean()) 37 self.assertTrue(current_file.is_clean())
38 38
39 39
@@ -43,13 +43,13 @@ class TestListlib(test.MATTest):
43 def test_list(self): 43 def test_list(self):
44 '''check if get_meta returns metadata''' 44 '''check if get_meta returns metadata'''
45 for _, dirty in self.file_list: 45 for _, dirty in self.file_list:
46 current_file = MAT.mat.create_class_file(dirty, False, add2archive=True) 46 current_file = libmat.mat.create_class_file(dirty, False, add2archive=True)
47 self.assertIsNotNone(current_file.get_meta()) 47 self.assertIsNotNone(current_file.get_meta())
48 48
49 def testlist_list_empty(self): 49 def testlist_list_empty(self):
50 '''check that a listing of a clean file returns an empty dict''' 50 '''check that a listing of a clean file returns an empty dict'''
51 for clean, _ in self.file_list: 51 for clean, _ in self.file_list:
52 current_file = MAT.mat.create_class_file(clean, False, add2archive=True) 52 current_file = libmat.mat.create_class_file(clean, False, add2archive=True)
53 self.assertEqual(current_file.get_meta(), dict()) 53 self.assertEqual(current_file.get_meta(), dict())
54 54
55 55
@@ -59,13 +59,13 @@ class TestisCleanlib(test.MATTest):
59 def test_dirty(self): 59 def test_dirty(self):
60 '''test is_clean on dirty files''' 60 '''test is_clean on dirty files'''
61 for _, dirty in self.file_list: 61 for _, dirty in self.file_list:
62 current_file = MAT.mat.create_class_file(dirty, False, add2archive=True) 62 current_file = libmat.mat.create_class_file(dirty, False, add2archive=True)
63 self.assertFalse(current_file.is_clean()) 63 self.assertFalse(current_file.is_clean())
64 64
65 def test_clean(self): 65 def test_clean(self):
66 '''test is_clean on clean files''' 66 '''test is_clean on clean files'''
67 for clean, _ in self.file_list: 67 for clean, _ in self.file_list:
68 current_file = MAT.mat.create_class_file(clean, False, add2archive=True) 68 current_file = libmat.mat.create_class_file(clean, False, add2archive=True)
69 self.assertTrue(current_file.is_clean()) 69 self.assertTrue(current_file.is_clean())
70 70
71 71
@@ -75,12 +75,12 @@ class TestFileAttributes(unittest.TestCase):
75 ''' 75 '''
76 def test_not_exist(self): 76 def test_not_exist(self):
77 ''' test MAT's behaviour on non-existent file''' 77 ''' test MAT's behaviour on non-existent file'''
78 self.assertFalse(MAT.mat.create_class_file('non_existent_file', False, add2archive=True)) 78 self.assertFalse(libmat.mat.create_class_file('non_existent_file', False, add2archive=True))
79 79
80 def test_empty(self): 80 def test_empty(self):
81 ''' test MAT's behaviour on empty file''' 81 ''' test MAT's behaviour on empty file'''
82 open('empty_file', 'a').close() 82 open('empty_file', 'a').close()
83 self.assertFalse(MAT.mat.create_class_file('empty_file', False, add2archive=True)) 83 self.assertFalse(libmat.mat.create_class_file('empty_file', False, add2archive=True))
84 os.remove('empty_file') 84 os.remove('empty_file')
85 85
86 86
@@ -91,12 +91,12 @@ class TestSecureRemove(unittest.TestCase):
91 ''' test the secure removal of an existing file 91 ''' test the secure removal of an existing file
92 ''' 92 '''
93 _, file_to_remove = tempfile.mkstemp() 93 _, file_to_remove = tempfile.mkstemp()
94 self.assertTrue(MAT.mat.secure_remove(file_to_remove)) 94 self.assertTrue(libmat.mat.secure_remove(file_to_remove))
95 95
96 def test_remove_fail(self): 96 def test_remove_fail(self):
97 ''' test the secure removal of an non-removable file 97 ''' test the secure removal of an non-removable file
98 ''' 98 '''
99 self.assertRaises(MAT.exceptions.UnableToWriteFile, MAT.mat.secure_remove, '/NOTREMOVABLE') 99 self.assertRaises(libmat.exceptions.UnableToWriteFile, libmat.mat.secure_remove, '/NOTREMOVABLE')
100 100
101 101
102class TestArchiveProcessing(test.MATTest): 102class TestArchiveProcessing(test.MATTest):
@@ -111,9 +111,9 @@ class TestArchiveProcessing(test.MATTest):
111 tar.add(dirty) 111 tar.add(dirty)
112 tar.add(clean) 112 tar.add(clean)
113 tar.close() 113 tar.close()
114 current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) 114 current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False)
115 current_file.remove_all() 115 current_file.remove_all()
116 current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) 116 current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False)
117 self.assertTrue(current_file.is_clean()) 117 self.assertTrue(current_file.is_clean())
118 118
119 def test_remove_tar(self): 119 def test_remove_tar(self):
@@ -125,9 +125,9 @@ class TestArchiveProcessing(test.MATTest):
125 tar.add(dirty) 125 tar.add(dirty)
126 tar.add(clean) 126 tar.add(clean)
127 tar.close() 127 tar.close()
128 current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) 128 current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False)
129 current_file.remove_all() 129 current_file.remove_all()
130 current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) 130 current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False)
131 self.assertTrue(current_file.is_clean()) 131 self.assertTrue(current_file.is_clean())
132 132
133 def test_remove_gz(self): 133 def test_remove_gz(self):
@@ -139,9 +139,9 @@ class TestArchiveProcessing(test.MATTest):
139 tar.add(dirty) 139 tar.add(dirty)
140 tar.add(clean) 140 tar.add(clean)
141 tar.close() 141 tar.close()
142 current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) 142 current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False)
143 current_file.remove_all() 143 current_file.remove_all()
144 current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) 144 current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False)
145 self.assertTrue(current_file.is_clean()) 145 self.assertTrue(current_file.is_clean())
146 146
147 def test_get_unsupported(self): 147 def test_get_unsupported(self):
@@ -152,16 +152,16 @@ class TestArchiveProcessing(test.MATTest):
152 for f in ('../mat.desktop', '../README.security', '../setup.py'): 152 for f in ('../mat.desktop', '../README.security', '../setup.py'):
153 tar.add(f, f[3:]) # trim '../' 153 tar.add(f, f[3:]) # trim '../'
154 tar.close() 154 tar.close()
155 current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) 155 current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False)
156 unsupported_files = set(current_file.is_clean(list_unsupported=True)) 156 unsupported_files = set(current_file.is_clean(list_unsupported=True))
157 self.assertEqual(unsupported_files, set(('mat.desktop', 'README.security', 'setup.py'))) 157 self.assertEqual(unsupported_files, set(('mat.desktop', 'README.security', 'setup.py')))
158 158
159 def test_archive_unwritable_content(self): 159 def test_archive_unwritable_content(self):
160 path = os.path.join(self.tmpdir, './unwritable_content.zip') 160 path = os.path.join(self.tmpdir, './unwritable_content.zip')
161 shutil.copy2('./unwritable_content.zip', self.tmpdir) 161 shutil.copy2('./unwritable_content.zip', self.tmpdir)
162 current_file = MAT.mat.create_class_file(path, False, add2archive=False) 162 current_file = libmat.mat.create_class_file(path, False, add2archive=False)
163 current_file.remove_all() 163 current_file.remove_all()
164 current_file = MAT.mat.create_class_file(path, False, add2archive=False) 164 current_file = libmat.mat.create_class_file(path, False, add2archive=False)
165 self.assertTrue(current_file.is_clean()) 165 self.assertTrue(current_file.is_clean())
166 166
167def get_tests(): 167def get_tests():