/usr/share/pyshared/quodlibet/debug/enc.py is in exfalso 2.3.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | # This is totally a giant hack.
# A totally awesome giant hack.
# When it works.
# Someone should make it better.
# Code originally by Knio from #pygame.
import os
import gc
import sys
import types
import quodlibet.const as const
import quodlibet.util as util
def __reloadmodule(module, reload=reload):
old = {}
old.update(module.__dict__)
reload(module)
new = module.__dict__
for key in old:
oldvalue = old[key]
newvalue = new[key]
if oldvalue is newvalue:
continue
refs = gc.get_referrers(oldvalue)
for ref in refs:
if ref is old:
continue
refs = gc.get_referrers(oldvalue)
for ref in refs:
if ref is old:
continue
if type(ref) == types.InstanceType:
if ref.__class__ is oldvalue:
ref.__class__ = newvalue
if type(ref) == types.DictType:
for i in ref:
if ref[i] is oldvalue:
ref[i] = newvalue
if type(ref) == types.ListType:
try:
while True:
ref[ref.index(oldvalue)] = newvalue
except ValueError:
pass
def reload():
for name, module in sys.modules.items():
if name == '__main__' or module == None:
continue
if name.startswith("quodlibet."):
name = name.replace(".", os.sep)
filename = os.path.join(const.BASEDIR, name[name.find(os.sep)+1:])
py = filename + ".py"
pyc = filename + ".pyc"
if util.mtime(pyc) and util.mtime(pyc) < util.mtime(py):
try: __reloadmodule(module)
except ImportError: pass
else: print_d("Reloading %s" % name)
|