131 lines
2.7 KiB
Python
Executable File
131 lines
2.7 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
import os.path as path
|
|
from shutil import copyfile
|
|
from glob import glob
|
|
|
|
SCRIPTNAME = path.basename(sys.argv[0])
|
|
SCRIPTDIR = sys.path[0]
|
|
|
|
EL_OBSOLETE = [
|
|
'appt.el',
|
|
'buff-menu+.el',
|
|
'cal-opts.el',
|
|
'calendar+.el',
|
|
'cc-mode+.el',
|
|
'character-fold+.el',
|
|
'def-face-const.el',
|
|
'dired-details+.el',
|
|
'highlight-fns.el',
|
|
'line-num.el',
|
|
'sort+.el',
|
|
'vc+.el',
|
|
'vc-.el',
|
|
'vc-hooks+.el',
|
|
]
|
|
|
|
EL_INVESTIGATE = [
|
|
'cmds-menu.el',
|
|
'delsel.el',
|
|
'descr-text+.el',
|
|
'doremi-cmd.el',
|
|
'doremi-frm.el',
|
|
'doremi-mac.el',
|
|
'doremi.el',
|
|
'face-remap+.el',
|
|
'facemenu+.el',
|
|
'filesets+.el',
|
|
'find-func+.el',
|
|
'font-lock-menus.el',
|
|
'fuzzy-match.el',
|
|
'help-macro+.el',
|
|
'highlight-chars.el',
|
|
'hl-defined.el',
|
|
'hl-spotlight.el',
|
|
'imenu+.el',
|
|
'isearch-prop.el',
|
|
'lib-requires.el',
|
|
'mkhtml.el',
|
|
'modeline-win.el',
|
|
'mouse3.el',
|
|
'narrow-indirect.el',
|
|
'oneonone.el',
|
|
'palette.el',
|
|
'pretty-lambdada.el',
|
|
'setup-keys.el',
|
|
'showkey.el',
|
|
'start-opt.el',
|
|
'subr+.el',
|
|
'ucs-cmds.el',
|
|
'unaccent.el',
|
|
'zoom-frm.el',
|
|
]
|
|
|
|
EL_EXCLUDE = [
|
|
'autofit-frame.el',
|
|
'delsel.el',
|
|
'echo-bell.el',
|
|
'emacs-init.el',
|
|
'emacsbug+.el',
|
|
'eyedropper.el',
|
|
'modeline-char.el',
|
|
'naked.el',
|
|
'reveal-next.el',
|
|
'setup-cygwin.el',
|
|
'setup.el',
|
|
'start.el',
|
|
'thumb-frm.el',
|
|
'w32browser-dlgopen.el',
|
|
'wimpy-del.el',
|
|
'yes-no.el',
|
|
]
|
|
|
|
EL_IGNORED = EL_OBSOLETE + EL_INVESTIGATE + EL_EXCLUDE
|
|
|
|
EL_FILES = sorted([x for x in glob('*.el') + glob('*/*.el')
|
|
if path.basename(x) not in EL_IGNORED],
|
|
key=lambda x: path.basename(x))
|
|
|
|
DST_DIRS = [
|
|
path.realpath(path.join(SCRIPTDIR, '../../lisp/icicles')),
|
|
path.realpath(path.join(SCRIPTDIR, '../../lisp/bmkp')),
|
|
path.realpath(path.join(SCRIPTDIR, '../../lisp/adams')),
|
|
#path.realpath(path.join(SCRIPTDIR, '../../lisp')),
|
|
]
|
|
|
|
def find_destinations(p, dirs):
|
|
ret = []
|
|
for dst in dirs:
|
|
if path.exists(path.join(dst, path.basename(p))):
|
|
ret.append(path.join(dst, path.basename(p)))
|
|
if len(ret) == 0:
|
|
return None
|
|
elif len(ret) == 1:
|
|
return ret[0]
|
|
return ret
|
|
|
|
|
|
def main():
|
|
for el in EL_FILES:
|
|
dst = find_destinations(el, DST_DIRS)
|
|
if dst:
|
|
if isinstance(dst, str):
|
|
copyfile(el, dst)
|
|
else:
|
|
print('[WRN] duplicate destination:', dst)
|
|
else:
|
|
print('[WRN] could not find', path.basename(el))
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
ret = 200
|
|
try:
|
|
ret = main()
|
|
except Exception as e:
|
|
print(e)
|
|
finally:
|
|
pass
|
|
sys.exit(ret)
|