]> git.phdru.name Git - phdru.name/phdru.name.git/blobdiff - dotfiles2html/dotfiles2html.py
Feat(dotfiles2html): Always remove `cgmem_nice`
[phdru.name/phdru.name.git] / dotfiles2html / dotfiles2html.py
index 38f9a317165f2c09e8c0894c703feb8c764aacad..7c6f95a18734d8cc32ded20a9de8443911a7b516 100755 (executable)
@@ -3,7 +3,10 @@
 __author__ = "Oleg Broytman <phd@phdru.name>"
 __copyright__ = "Copyright (C) 2004-2020 PhiloSoft Design"
 
-import os, shutil, filecmp
+import filecmp
+import os
+import re
+import shutil
 os.umask(0022) # octal; -rw-r--r--
 
 from m_lib.m_path import get_homedir
@@ -73,10 +76,13 @@ def process_dotfile(i, fname, ftype, file_types):
     if not os.path.exists(fname):
         return
 
-    if fname in ('mailcap', 'mc.ext', 'menu') and os.path.exists(fname):
-        file = open(fname, 'r')
-        text = file.read()
-        file.close()
+    file = open(fname, 'r')
+    text = file.read()
+    file.close()
+
+    text = re.sub('cgmem_nice \d+ ', '', text)
+
+    if fname in ('mailcap', 'mc.ext', 'menu'):
         file = open(fname, 'w')
         text = text.replace('mplay', 'mplayer')
         text = text.replace('mplayerer', 'mplayer')
@@ -87,12 +93,10 @@ def process_dotfile(i, fname, ftype, file_types):
         file.write(text)
         file.close()
 
-    elif fname == 'vimrc' and os.path.exists(fname):
-        file = open('vimrc', 'r')
-        text = file.read()
-        file.close()
-        file = open('vimrc', 'w')
-        file.write(text.replace('\033', '<Esc>'))
+    elif fname == 'vimrc':
+        file = open(fname, 'w')
+        text = text.replace('\033', '<Esc>')
+        file.write(text)
         file.close()
 
     os.system("""exec gvim -f -c "set filetype=%s" -c ":source %s/dotfile2html.vim" "%s"