Loading installsystems/database.py +2 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,8 @@ from installsystems.tarball import Tarball from installsystems.printer import * class Database(object): ''' Abstract repo database stuff ''' Abstract repo database stuff It needs to be local cause of sqlite3 which need to open a file ''' Loading installsystems/image.py +1 −1 Original line number Diff line number Diff line Loading @@ -615,7 +615,7 @@ class Payload(object): @property def info(self): ''' return a dict of info about current payload Return a dict of info about current payload ''' return {"md5": self.md5, "size": self.size, Loading installsystems/printer.py +6 −2 Original line number Diff line number Diff line Loading @@ -32,7 +32,9 @@ color = { _arrow_level = 1 def out(message="", fd=sys.stdout, endl=os.linesep, flush=True): '''Print message colorised in fd ended by endl''' ''' Print message colorised in fd ended by endl ''' # color subsitution for c in color: message = message.replace("#%s#" % c, color[c]) Loading @@ -42,7 +44,9 @@ def out(message="", fd=sys.stdout, endl=os.linesep, flush=True): fd.flush() def err(message, fd=sys.stderr, endl=os.linesep): '''Print a message on stderr''' ''' Print a message on stderr ''' out(message, fd, endl) def fatal(message, quit=True, fd=sys.stderr, endl=os.linesep): Loading installsystems/repository.py +7 −7 Original line number Diff line number Diff line Loading @@ -227,7 +227,7 @@ class Repository(object): def get(self, name, version): ''' return a image from a name and version Return an image from a name and version ''' # get file md5 from db r = self.db.ask("select md5 from image where name = ? and version = ? limit 1", Loading @@ -242,8 +242,8 @@ class Repository(object): def getmd5(self, name, version): ''' return a image md5 and payload md5 from name and version. Order matter ! image md5 will still be the first Return an image md5 and payload md5 from name and version. Order matter ! Image md5 will still be the first ''' # get file md5 from db a = self.db.ask("SELECT md5 FROM image WHERE name = ? AND version = ? LIMIT 1", Loading Loading @@ -305,7 +305,7 @@ class RepositoryConfig(object): @property def lastpath(self): ''' return the last file complete path Return the last file complete path ''' if self._lastpath is None: return os.path.join(self.path, self.lastname) Loading @@ -321,7 +321,7 @@ class RepositoryConfig(object): @property def dbpath(self): ''' return the db complete path Return the db complete path ''' if self._dbpath is None: return os.path.join(self.path, self.dbname) Loading Loading @@ -452,7 +452,7 @@ class RepositoryManager(object): # delete temporary files (used by db) for f in self.tempfiles: try: debug("Removing temporaty db file %s" % f) debug("Removing temporary db file %s" % f) os.unlink(f) except OSError: pass Loading @@ -466,7 +466,7 @@ class RepositoryManager(object): def __getitem__(self, key): ''' Return a repostiory by its possition in list Return a repostiory by its position in list ''' return self.repos[key] Loading installsystems/tarball.py +9 −3 Original line number Diff line number Diff line Loading @@ -14,7 +14,9 @@ import re class Tarball(tarfile.TarFile): def add_str(self, name, content, ftype, mode): '''Add a string in memory as a file in tarball''' ''' Add a string in memory as a file in tarball ''' ti = tarfile.TarInfo(name) ti.type = ftype ti.mode = mode Loading @@ -25,7 +27,9 @@ class Tarball(tarfile.TarFile): self.addfile(ti, StringIO.StringIO(content)) def get_str(self, name): '''Return a string from a filename in a tarball''' ''' Return a string from a filename in a tarball ''' ti = self.getmember(name) return self.extractfile(ti).read() Loading @@ -38,7 +42,9 @@ class Tarball(tarfile.TarFile): if re.match(reg_pattern, tpname) ] def size(self): '''Return real (uncompressed) size of the tarball''' ''' Return real (uncompressed) size of the tarball ''' total_sz = 0 for ti in self.getmembers(): total_sz += ti.size Loading Loading
installsystems/database.py +2 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,8 @@ from installsystems.tarball import Tarball from installsystems.printer import * class Database(object): ''' Abstract repo database stuff ''' Abstract repo database stuff It needs to be local cause of sqlite3 which need to open a file ''' Loading
installsystems/image.py +1 −1 Original line number Diff line number Diff line Loading @@ -615,7 +615,7 @@ class Payload(object): @property def info(self): ''' return a dict of info about current payload Return a dict of info about current payload ''' return {"md5": self.md5, "size": self.size, Loading
installsystems/printer.py +6 −2 Original line number Diff line number Diff line Loading @@ -32,7 +32,9 @@ color = { _arrow_level = 1 def out(message="", fd=sys.stdout, endl=os.linesep, flush=True): '''Print message colorised in fd ended by endl''' ''' Print message colorised in fd ended by endl ''' # color subsitution for c in color: message = message.replace("#%s#" % c, color[c]) Loading @@ -42,7 +44,9 @@ def out(message="", fd=sys.stdout, endl=os.linesep, flush=True): fd.flush() def err(message, fd=sys.stderr, endl=os.linesep): '''Print a message on stderr''' ''' Print a message on stderr ''' out(message, fd, endl) def fatal(message, quit=True, fd=sys.stderr, endl=os.linesep): Loading
installsystems/repository.py +7 −7 Original line number Diff line number Diff line Loading @@ -227,7 +227,7 @@ class Repository(object): def get(self, name, version): ''' return a image from a name and version Return an image from a name and version ''' # get file md5 from db r = self.db.ask("select md5 from image where name = ? and version = ? limit 1", Loading @@ -242,8 +242,8 @@ class Repository(object): def getmd5(self, name, version): ''' return a image md5 and payload md5 from name and version. Order matter ! image md5 will still be the first Return an image md5 and payload md5 from name and version. Order matter ! Image md5 will still be the first ''' # get file md5 from db a = self.db.ask("SELECT md5 FROM image WHERE name = ? AND version = ? LIMIT 1", Loading Loading @@ -305,7 +305,7 @@ class RepositoryConfig(object): @property def lastpath(self): ''' return the last file complete path Return the last file complete path ''' if self._lastpath is None: return os.path.join(self.path, self.lastname) Loading @@ -321,7 +321,7 @@ class RepositoryConfig(object): @property def dbpath(self): ''' return the db complete path Return the db complete path ''' if self._dbpath is None: return os.path.join(self.path, self.dbname) Loading Loading @@ -452,7 +452,7 @@ class RepositoryManager(object): # delete temporary files (used by db) for f in self.tempfiles: try: debug("Removing temporaty db file %s" % f) debug("Removing temporary db file %s" % f) os.unlink(f) except OSError: pass Loading @@ -466,7 +466,7 @@ class RepositoryManager(object): def __getitem__(self, key): ''' Return a repostiory by its possition in list Return a repostiory by its position in list ''' return self.repos[key] Loading
installsystems/tarball.py +9 −3 Original line number Diff line number Diff line Loading @@ -14,7 +14,9 @@ import re class Tarball(tarfile.TarFile): def add_str(self, name, content, ftype, mode): '''Add a string in memory as a file in tarball''' ''' Add a string in memory as a file in tarball ''' ti = tarfile.TarInfo(name) ti.type = ftype ti.mode = mode Loading @@ -25,7 +27,9 @@ class Tarball(tarfile.TarFile): self.addfile(ti, StringIO.StringIO(content)) def get_str(self, name): '''Return a string from a filename in a tarball''' ''' Return a string from a filename in a tarball ''' ti = self.getmember(name) return self.extractfile(ti).read() Loading @@ -38,7 +42,9 @@ class Tarball(tarfile.TarFile): if re.match(reg_pattern, tpname) ] def size(self): '''Return real (uncompressed) size of the tarball''' ''' Return real (uncompressed) size of the tarball ''' total_sz = 0 for ti in self.getmembers(): total_sz += ti.size Loading