#self.grepexcluded = (pathlib.Path(PATHS["share"], "grepexcluded.txt")) #from a system without audio software installed: find /usr/bin -printf "%f\n" | sort > grepexcluded.txt
def__init__(self):
self.progressHook=nothing#prevents the initial programstart from sending meaningless messages for the cached data. Set and reverted in self.build
self.grepexcluded=(pathlib.Path(PATHS["share"],"grepexcluded.txt"))#created by hand. see docstring
#assert self.grepexcluded.exists()
self.blacklist=("nsmd","non-daw","carla")#only programs that have to do with audio and music. There is another general blacklist that speeds up discovery
self.morePrograms=("thisdoesnotexisttest","carla-rack","carla-patchbay","carla-jack-multi","ardour5","ardour6","nsm-data","nsm-jack")#only programs not found by buildCache_grepExecutablePaths because they are just shellscripts and do not contain /nsm/server/announce.
self.userWhitelist=()#added dynamically to morePrograms
self.userBlacklist=()#added dynamically to blacklist
self.blacklist=("nsmd","non-daw","carla","argodejo","adljack")#only programs that have to do with audio and music. There is another general blacklist that speeds up discovery
)#shortcut list and programs not found by buildCache_grepExecutablePaths because they are just shellscripts and do not contain /nsm/server/announce.
self.userWhitelist=()#added dynamically to morePrograms. highest priority
self.userBlacklist=()#added dynamically to blacklist. highest priority
self.knownDesktopFiles={#shortcuts to the correct desktop files. Reverse lookup binary->desktop creates false entries, for example ZynAddSubFx and Carla.
"zynaddsubfx":"zynaddsubfx-jack.desktop",#value will later get replaced with the .desktop entry
"carla-jack-multi":"carla.desktop",
@ -71,8 +86,8 @@ class SupportedProgramsDatabase(object):
self.unfilteredExecutables=None#in build()
#self.build() #fills self.programs and
defbuildCache_grepExecutablePaths(self):#TODO: this is a time consuming process. But is has a chance of finding programs that would have been missed otherwise.
"""return a list of executable names in the path
defbuildCache_grepExecutablePaths(self)->list:
"""return a list of executable names in the path (not the path itself)
executablePaths=set([pathlib.Path(p).resolve()forpinos.environ["PATH"].split(os.pathsep)])#resolve filters out symlinks, like arches /sbin and /bin. set() makes it unique
completedProcess=subprocess.run(command,stdout=subprocess.PIPE,stderr=subprocess.PIPE,universal_newlines=True,shell=True)#universal_newlines is an alias for text, which was deprecated in 3.7 because text is more understandable. capture_output replaces the two PIPEs in 3.7
forfullPathincompletedProcess.stdout.split():
exe=pathlib.Path(fullPath).relative_to(path)
ifnotstr(exe)inself.blacklist+self.userBlacklist:
self.progressHook(f"{fullPath}")
exe=pathlib.Path(fullPath).relative_to(path)
ifnotstr(exe)inexcludeFromProcessingSet:#skip over any known file, good or bad
result.append((str(exe),str(fullPath)))
forprginself.morePrograms+self.userWhitelist:
forprginwhiteSet:
self.progressHook(f"{prg}")
forpathinexecutablePaths:
ifpathlib.Path(path,prg).is_file():
ifpathlib.Path(path,prg).is_file():#check if this actually exists