diff options
Diffstat (limited to 'ebuildgen/scmprojects.py')
-rw-r--r-- | ebuildgen/scmprojects.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ebuildgen/scmprojects.py b/ebuildgen/scmprojects.py new file mode 100644 index 0000000..7310c0b --- /dev/null +++ b/ebuildgen/scmprojects.py @@ -0,0 +1,25 @@ +from subprocess import call +import sys + +cmdlineget = { + "svn" : "svn checkout ", + "git" : "git clone ", + "hg" : "hg clone ", + "www" : "wget ", + } + +def getsourcecode(adress,repotype): + """This downloads the sourcecode to /tmp/ebuildgen/curproj + + Supply the adress to the source code and repo type + """ + callstr = cmdlineget[repotype] + + try: + retcode = call(callstr + adress + " /tmp/ebuildgen/curproj",shell=True) + if retcode < 0: + print("Child was terminated by signal", -retcode, file=sys.stderr) + else: + print("Child returned", retcode, file=sys.stderr) + except OSError as e: + print("Execution failed:", e, file=sys.stderr) |