summaryrefslogtreecommitdiff
path: root/audio/mma/files/mma_g.py.in
diff options
context:
space:
mode:
Diffstat (limited to 'audio/mma/files/mma_g.py.in')
-rw-r--r--audio/mma/files/mma_g.py.in59
1 files changed, 0 insertions, 59 deletions
diff --git a/audio/mma/files/mma_g.py.in b/audio/mma/files/mma_g.py.in
deleted file mode 100644
index 77ee3dc2cd1f..000000000000
--- a/audio/mma/files/mma_g.py.in
+++ /dev/null
@@ -1,59 +0,0 @@
-#!%%PYTHON_CMD%%
-#
-# -*- encoding: utf-8 -*-
-
-import os
-import pickle
-import stat
-
-def traverse(path):
-
- for directory, dirnames, filenames in os.walk(path):
-
- if '.mmaDB' in filenames:
-
- mmaDB = os.path.join(directory, '.mmaDB')
- mmaDB = os.path.normpath(mmaDB)
-
- fixMMAdb(mmaDB)
-
-def changePath(path):
- path_components = path.split('/')
-
- try:
- index = path_components.index('lib') + 1
- except ValueError:
- return path
-
- path_components[0:index] = []
-
- p = '/'.join(path_components)
- p = os.path.join('%%DATADIR%%/lib', p)
-
- return p
-
-def fixMMAdb(fn):
-
- orig_filemode = os.stat(fn).st_mode
-
- os.chmod(fn, orig_filemode | stat.S_IWUSR)
-
- mmaDB = open(fn, 'r+b')
- mmaDB.readline() # skip header
-
- p = pickle.load(mmaDB)
- p = dict((changePath(k), v) for k, v in p.items())
-
- mmaDB.seek(0)
- # write header
- mmaDB.write(b'### mmaDB ... AUTOGENERATED BINARY DATA. DO NOT EDIT!!!\n')
-
- pickle.dump(p, mmaDB, pickle.HIGHEST_PROTOCOL)
-
- mmaDB.close()
-
- os.chmod(fn, orig_filemode)
-
-if __name__ == '__main__':
- traverse('.')
-