diff options
author | 2011-08-15 18:49:53 +0200 | |
---|---|---|
committer | 2011-08-15 18:49:53 +0200 | |
commit | 332728a69e8b07e2fb5e1d928f9092010ed739b5 (patch) | |
tree | 87db4d8a553e248146c618f3943f1db33112719f | |
parent | Added "gentoopm" to check for already installed packages (diff) | |
download | ebuildgen-332728a69e8b07e2fb5e1d928f9092010ed739b5.tar.gz ebuildgen-332728a69e8b07e2fb5e1d928f9092010ed739b5.tar.bz2 ebuildgen-332728a69e8b07e2fb5e1d928f9092010ed739b5.zip |
Began working on install script
-rwxr-xr-x | cli.py | 101 | ||||
-rw-r--r-- | ebuildgen/__init__.py | 1 | ||||
-rwxr-xr-x | ebuildgen/cli.py | 102 | ||||
-rw-r--r-- | ebuildgen/ebuildoutput.py (renamed from ebuildgen.py) | 2 | ||||
-rw-r--r-- | ebuildgen/filetypes/__init__.py (renamed from filetypes/__init__.py) | 0 | ||||
-rw-r--r-- | ebuildgen/filetypes/acif.py (renamed from filetypes/acif.py) | 0 | ||||
-rw-r--r-- | ebuildgen/filetypes/autoconf.py (renamed from filetypes/autoconf.py) | 2 | ||||
-rw-r--r-- | ebuildgen/filetypes/automake.py (renamed from filetypes/automake.py) | 0 | ||||
-rw-r--r-- | ebuildgen/filetypes/ctypefiles.py (renamed from filetypes/ctypefiles.py) | 0 | ||||
-rw-r--r-- | ebuildgen/filetypes/makefilecom.py (renamed from filetypes/makefilecom.py) | 0 | ||||
-rw-r--r-- | ebuildgen/filetypes/makefiles.py (renamed from filetypes/makefiles.py) | 2 | ||||
-rw-r--r-- | ebuildgen/linkdeps.py (renamed from linkdeps.py) | 2 | ||||
-rw-r--r-- | ebuildgen/scanfiles.py (renamed from scanfiles.py) | 10 | ||||
-rw-r--r-- | ebuildgen/scmprojects.py (renamed from scmprojects.py) | 0 | ||||
-rwxr-xr-x | genebuild | 5 | ||||
-rw-r--r-- | test.h | 43 |
16 files changed, 117 insertions, 153 deletions
@@ -1,101 +0,0 @@ -#!/usr/bin/python3 - -import argparse -import scanfiles -import linkdeps -import ebuildgen -from scmprojects import getsourcecode - -parser = argparse.ArgumentParser( - description="Scan a dir for files and output includes", - epilog="Example: cli.py ~/my/project -t .c .h") - -parser.add_argument("dir") -parser.add_argument("-t", "--types", metavar="filetype", nargs="+", - default=[".c",".cpp",".h"], - help="what filetypes it should scan") -parser.add_argument("-g", "--ginc", action="store_true", - help="print global includes") -parser.add_argument("-l", "--linc", action="store_true", - help="print local includes") -parser.add_argument("-d", "--ifdef", action="store_true", - help="print includes the depends on ifdefs") -parser.add_argument("-q", "--quiet", action="store_true", - help="don't print anything") #this needs work... - -parser.add_argument("--svn", action="store_true", - help="this is a SVN project") -parser.add_argument("--git", action="store_true", - help="this is a GIT project") -parser.add_argument("--hg", action="store_true", - help="this is a HG project") - -args = parser.parse_args() - -#print(args.dir) -#print(args.types) - -#inclst is a list of includes. First in it is global then local. -if args.svn: - getsourcecode(args.dir,"svn") - srcdir = "/tmp/ebuildgen/curproj" - dltype = "svn" -elif args.git: - getsourcecode(args.dir,"git") - srcdir = "/tmp/ebuildgen/curproj" - dltype = "git" -elif args.hg: - getsourcecode(args.dir,"hg") - srcdir = "/tmp/ebuildgen/curproj" - dltype = "hg" -else: - srcdir = args.dir - dltype = "www" - -(iuse,inclst,useargs) = scanfiles.scanproject(srcdir,"autotools") -targets = [["install"]] -binaries = [] -gpackages = set() -for dep in inclst[0]: - newpack = linkdeps.deptopackage(dep,[]) - if newpack: - gpackages.add(newpack) -#print(gpackages) -if "__cplusplus" in inclst[2]: - for dep in inclst[2]["__cplusplus"][0]: - newpack = linkdeps.deptopackage(dep,[]) - if newpack: - gpackages.add(newpack) - -usedeps = {} -for use in useargs: - packages = set() - for dep in useargs[use][0]: - newpack = linkdeps.deptopackage(dep,[]) - if newpack and not newpack in gpackages: - packages.add(newpack) - if "__cplusplus" in useargs[use][2]: - for dep in useargs[use][2]["__cplusplus"][0]: - newpack = linkdeps.deptopackage(dep,[]) - if newpack and not newpack in gpackages: - packages.add(newpack) - usedeps[use] = packages - -#print(usedeps) -#print(iuse) -ebuildgen.genebuild(iuse,gpackages,usedeps,dltype,args.dir,targets,binaries) - -if args.ginc == args.linc == args.ifdef == args.quiet == False: - print(inclst) - print(gpackages) - -if args.ginc: - print(inclst[0]) -if args.linc: - print(inclst[1]) - -if args.ifdef: - for name in inclst[2]: - print(name) - print(inclst[2][name][0]) - print(inclst[2][name][1]) diff --git a/ebuildgen/__init__.py b/ebuildgen/__init__.py new file mode 100644 index 0000000..e0a8d1b --- /dev/null +++ b/ebuildgen/__init__.py @@ -0,0 +1 @@ +#Placeholder diff --git a/ebuildgen/cli.py b/ebuildgen/cli.py new file mode 100755 index 0000000..6457853 --- /dev/null +++ b/ebuildgen/cli.py @@ -0,0 +1,102 @@ +#!/usr/bin/python3 + +import argparse +import ebuildgen.scanfiles as scanfiles +import ebuildgen.linkdeps as linkdeps +import ebuildgen.ebuildoutput as ebuildoutput +from ebuildgen.scmprojects import getsourcecode + +def cli(): + parser = argparse.ArgumentParser( + description="Generate ebuilds for autotools projects", + epilog="Example: genebuild --svn <url>") + + parser.add_argument("url") + parser.add_argument("-t", "--types", metavar="filetype", nargs="+", + default=[".c",".cpp",".h"], + help="what filetypes it should scan") + parser.add_argument("-g", "--ginc", action="store_true", + help="print global includes") + parser.add_argument("-l", "--linc", action="store_true", + help="print local includes") + parser.add_argument("-d", "--ifdef", action="store_true", + help="print includes the depends on ifdefs") + parser.add_argument("-q", "--quiet", action="store_true", + help="don't print anything (doesn't work ATM)") #this needs work... + + parser.add_argument("--svn", action="store_true", + help="this is a SVN project") + parser.add_argument("--git", action="store_true", + help="this is a GIT project") + parser.add_argument("--hg", action="store_true", + help="this is a HG project") + + args = parser.parse_args() + + #print(args.dir) + #print(args.types) + + #inclst is a list of includes. First in it is global then local. + if args.svn: + getsourcecode(args.dir,"svn") + srcdir = "/tmp/ebuildgen/curproj" + dltype = "svn" + elif args.git: + getsourcecode(args.dir,"git") + srcdir = "/tmp/ebuildgen/curproj" + dltype = "git" + elif args.hg: + getsourcecode(args.dir,"hg") + srcdir = "/tmp/ebuildgen/curproj" + dltype = "hg" + else: + srcdir = args.dir + dltype = "www" + + (iuse,inclst,useargs) = scanfiles.scanproject(srcdir,"autotools") + targets = [["install"]] + binaries = [] + gpackages = set() + for dep in inclst[0]: + newpack = linkdeps.deptopackage(dep,[]) + if newpack: + gpackages.add(newpack) + #print(gpackages) + if "__cplusplus" in inclst[2]: + for dep in inclst[2]["__cplusplus"][0]: + newpack = linkdeps.deptopackage(dep,[]) + if newpack: + gpackages.add(newpack) + + usedeps = {} + for use in useargs: + packages = set() + for dep in useargs[use][0]: + newpack = linkdeps.deptopackage(dep,[]) + if newpack and not newpack in gpackages: + packages.add(newpack) + if "__cplusplus" in useargs[use][2]: + for dep in useargs[use][2]["__cplusplus"][0]: + newpack = linkdeps.deptopackage(dep,[]) + if newpack and not newpack in gpackages: + packages.add(newpack) + usedeps[use] = packages + + #print(usedeps) + #print(iuse) + ebuildoutput.genebuild(iuse,gpackages,usedeps,dltype,args.dir,targets,binaries) + + if args.ginc == args.linc == args.ifdef == args.quiet == False: + print(inclst) + print(gpackages) + + if args.ginc: + print(inclst[0]) + if args.linc: + print(inclst[1]) + + if args.ifdef: + for name in inclst[2]: + print(name) + print(inclst[2][name][0]) + print(inclst[2][name][1]) diff --git a/ebuildgen.py b/ebuildgen/ebuildoutput.py index d25fa7c..a8ca3a6 100644 --- a/ebuildgen.py +++ b/ebuildgen/ebuildoutput.py @@ -23,7 +23,7 @@ def genebuild(iuse,deps,usedeps,dltype,adress,targets,binaries): installmethod = guessinstall(targets,binaries) outstr = outputebuild(iuse,deps,usedeps,dltype,adress,installmethod) - f = open("/tmp/workfile.ebuild","w") + f = open("/tmp/ebuildgen/generated.ebuild","w") f.write(outstr) f.close() diff --git a/filetypes/__init__.py b/ebuildgen/filetypes/__init__.py index e69de29..e69de29 100644 --- a/filetypes/__init__.py +++ b/ebuildgen/filetypes/__init__.py diff --git a/filetypes/acif.py b/ebuildgen/filetypes/acif.py index 1d3ed29..1d3ed29 100644 --- a/filetypes/acif.py +++ b/ebuildgen/filetypes/acif.py diff --git a/filetypes/autoconf.py b/ebuildgen/filetypes/autoconf.py index 6e4b0dc..d46d133 100644 --- a/filetypes/autoconf.py +++ b/ebuildgen/filetypes/autoconf.py @@ -355,7 +355,7 @@ def scanacfile(acfile): items = yacc.parse(acfile) return items -from filetypes.acif import parseif +from ebuildgen.filetypes.acif import parseif def output(inputlst,topdir): variables = dict() diff --git a/filetypes/automake.py b/ebuildgen/filetypes/automake.py index c4ca432..c4ca432 100644 --- a/filetypes/automake.py +++ b/ebuildgen/filetypes/automake.py diff --git a/filetypes/ctypefiles.py b/ebuildgen/filetypes/ctypefiles.py index 50b20ed..50b20ed 100644 --- a/filetypes/ctypefiles.py +++ b/ebuildgen/filetypes/ctypefiles.py diff --git a/filetypes/makefilecom.py b/ebuildgen/filetypes/makefilecom.py index e76a15c..e76a15c 100644 --- a/filetypes/makefilecom.py +++ b/ebuildgen/filetypes/makefilecom.py diff --git a/filetypes/makefiles.py b/ebuildgen/filetypes/makefiles.py index fd9b80f..881a860 100644 --- a/filetypes/makefiles.py +++ b/ebuildgen/filetypes/makefiles.py @@ -1,7 +1,7 @@ from ply import lex from ply import yacc import glob -from filetypes.makefilecom import expand +from ebuildgen.filetypes.makefilecom import expand def scanmakefile(makefile): """Scan supplied makefile. diff --git a/linkdeps.py b/ebuildgen/linkdeps.py index a816596..655af1c 100644 --- a/linkdeps.py +++ b/ebuildgen/linkdeps.py @@ -14,7 +14,7 @@ def qfiletopackage(dep,addpaths): """ print(dep) - (statuscode,outstr) = getstatusoutput('echo "" | `gcc -print-prog-name=cc1` -v') + (statuscode,outstr) = getstatusoutput('echo "" | `gcc -print-prog-name=cc1` -v -q') #"`gcc -print-prog-name=cc1plus` -v" for cpp outlst = outstr.split("\n") incpaths = [] diff --git a/scanfiles.py b/ebuildgen/scanfiles.py index b961037..06d2c21 100644 --- a/scanfiles.py +++ b/ebuildgen/scanfiles.py @@ -1,10 +1,10 @@ import os import glob -from filetypes.ctypefiles import scanincludes -from filetypes.makefiles import scanmakefile -from filetypes.makefilecom import expand -from filetypes.autoconf import scanac -from filetypes.automake import initscan +from ebuildgen.filetypes.ctypefiles import scanincludes +from ebuildgen.filetypes.makefiles import scanmakefile +from ebuildgen.filetypes.makefilecom import expand +from ebuildgen.filetypes.autoconf import scanac +from ebuildgen.filetypes.automake import initscan def scandirfor(dir, filetypes): """Scans recursivly the supplied dir for provided filetypes. diff --git a/scmprojects.py b/ebuildgen/scmprojects.py index 7310c0b..7310c0b 100644 --- a/scmprojects.py +++ b/ebuildgen/scmprojects.py diff --git a/genebuild b/genebuild new file mode 100755 index 0000000..dee70ff --- /dev/null +++ b/genebuild @@ -0,0 +1,5 @@ +#!/usr/bin/python3 + +from ebuildgen.cli import cli + +cli() @@ -1,43 +0,0 @@ -#ifdef IFDEF1 - #include "ifdef1.h" -#endif - -#include <glob1.h> -#include <io> -#include <glob2.h> -#include "loc1.h" -/* -#include "comment.h" -sdasdasdasd */ -// #include "linecom.h" -#include "loc2.h" -#include <strings> -/* ok... */ -#include <glob3.h> - -#if 0 - #if 0 - - #endif -#include <if0_wrong.h> -#endif - -#ifdef IFDEF2 - #include <ifdef2.h> -#endif - -#include "loc3.h" - -#ifdef IFDEF2 - #include <ifdef2.h> - #ifdef IFDEF3 - #include "ifdef3.h" - #endif - #include "ifdef2.h" -#endif - -#ifdef IFDEF2 - #ifdef IFDEF3 - #include <ifdef3.h> - #endif -#endif |