diff options
author | Auke Booij (tulcod) <auke@tulcod.com> | 2010-06-09 17:04:51 +0200 |
---|---|---|
committer | Auke Booij (tulcod) <auke@tulcod.com> | 2010-06-09 17:04:51 +0200 |
commit | 2f25ba6f0c8976e18bb6d0c7e9140a736a148e1d (patch) | |
tree | fa9b299b6b31fcbc7468493001ec0b62ed7228e9 | |
parent | Some rfc822 black magic, let's hope this keeps working during the next few we... (diff) | |
download | g-cran-2f25ba6f0c8976e18bb6d0c7e9140a736a148e1d.tar.gz g-cran-2f25ba6f0c8976e18bb6d0c7e9140a736a148e1d.tar.bz2 g-cran-2f25ba6f0c8976e18bb6d0c7e9140a736a148e1d.zip |
Moving some code around
-rw-r--r-- | ebuild.py | 20 | ||||
-rw-r--r-- | filetricks.py | 14 | ||||
-rwxr-xr-x | g-cran.py | 55 |
3 files changed, 36 insertions, 53 deletions
diff --git a/ebuild.py b/ebuild.py new file mode 100644 index 0000000..9c1d5bc --- /dev/null +++ b/ebuild.py @@ -0,0 +1,20 @@ +#Class for PMS-style packages +class Package(): + def __init__(self): + #todo add needed variables as __init__ arguments + self.pn='' + self.pv='' + self.description='' + self.homepage='' + self.iuse='' + self.keywords='' + self.license='' + self.slot='0' + self.src_uri='' + self.eapi='3' + self.depend=[] + self.pdepend=[] + self.rdepend=[] + self.provide=[] + self.restrict=[] + self.properties='' diff --git a/filetricks.py b/filetricks.py new file mode 100644 index 0000000..cb4e292 --- /dev/null +++ b/filetricks.py @@ -0,0 +1,14 @@ +class EmptyLinesFile: + def __init__(self,myfile): + self.file=myfile + self.eof=False + self.lines=self.generate_lines() + def generate_lines(self,size=-1): + for line in self.file: + yield line + self.eof=True + def readline(self): + try: + return self.lines.next() + except StopIteration: + return '' @@ -1,5 +1,7 @@ #!/usr/bin/python import getopt, sys, os, string, urllib, re +from filetricks import * +from ebuild import * #note: this script makes use of exceptions @@ -8,59 +10,6 @@ __doc__="Usage: "+sys.argv[0]+" <local repository directory> <action> [<action a REPO_MYDIR=".g-cran" REPO_CONFFILE="settings.cfg" -#Class for PMS-style packages -class Package(): - def __init__(self): - #todo add needed variables as __init__ arguments - self.pn='' - self.pv='' - self.description='' - self.homepage='' - self.iuse='' - self.keywords='' - self.license='' - self.slot='0' - self.src_uri='' - self.eapi='3' - self.depend=[] - self.pdepend=[] - self.rdepend=[] - self.provide=[] - self.restrict=[] - self.properties='' - - -class EmptyLinesFile: - def __init__(self,myfile): - self.file=myfile - self.eof=False - self.lines=self.generate_lines() - def generate_lines(self,size=-1): - for line in self.file: - yield line - self.eof=True - def readline(self): - try: - return self.lines.next() - except StopIteration: - return '' - -#This function is not being used anywhere and may be removed -#def read_settings(repo_location): -# try: -# settings_file=open(os.path.join(repo_location,REPO_MYDIR,REPO_CONFFILE),'r') -# settings={} -# for line in settings_file: -# parts=string.split(line,'=') -# if len(parts)==1: -# raise ValueError -# settings[parts[0]]='='.join(parts[1:]) -# return settings -# except IOError: -# print "Could not open settings file at "+settings_file -# print "If you haven't synced this repository yet, please append the remote repository's URI" -# sys.exit(0) - #Parse package options into values we can work with in accordance with PMS def pmsify_packages_data(data): #fix settings: |