diff options
-rwxr-xr-x | cli.py | 4 | ||||
-rw-r--r-- | linkdeps.py | 10 | ||||
-rw-r--r-- | scanfiles.py | 22 |
3 files changed, 25 insertions, 11 deletions
@@ -57,7 +57,9 @@ targets = [["install"]] binaries = [] gpackages = set() for dep in inclst[0]: - gpackages.add(linkdeps.deptopackage(dep,[])) + newpack = linkdeps.deptopackage(dep,[]) + if newpack: + gpackages.add(newpack) #print(gpackages) if "__cplusplus" in inclst[2]: for dep in inclst[2]["__cplusplus"][0]: diff --git a/linkdeps.py b/linkdeps.py index 01b1fb9..a816596 100644 --- a/linkdeps.py +++ b/linkdeps.py @@ -1,6 +1,7 @@ import os from subprocess import getstatusoutput from urllib.request import urlopen +import gentoopm def deptopackage(dep,addpaths): #return pfltopackage(dep,addpaths) @@ -44,8 +45,15 @@ def qfiletopackage(dep,addpaths): package = pfltopackage(dep,incpaths) print(package) + #check if package exists + pm=gentoopm.get_package_manager() if package: - return package[0] + #does the package exist in this computers package manager? + if pm.stack.filter(package[0]): + return package[0] + else: + print("No package named: " + package[0] + " found localy, ignoring") + return [] else: return package diff --git a/scanfiles.py b/scanfiles.py index fc701f6..b961037 100644 --- a/scanfiles.py +++ b/scanfiles.py @@ -109,17 +109,21 @@ def scanautotoolsdeps(acfile,amfile): else: useargs[usearg] = [src] + ifdef_lst = [includes[2]] + for usearg in useargs: useargs[usearg] = scanfilelist(useargs[usearg],src_incflag) - - for ifdef in includes[2]: - for switch in iflst: - if ifdef in switch[1]: - usearg = inter_useflag(switch[0]) - if usearg in useargs: - useargs[usearg][0].update(includes[2][ifdef][0]) - else: - useargs[usearg] = includes[2][ifdef] + ifdef_lst += [useargs[usearg][2]] + + for ifdef in ifdef_lst: + for item in ifdef: + for switch in iflst: + if item in switch[1]: + usearg = inter_useflag(switch[0]) + if usearg in useargs: + useargs[usearg][0].update(ifdef[item][0]) + else: + useargs[usearg] = ifdef[item] #print(useargs) #print(includes) return useflags,includes,useargs |