Loading installsystems/repository.py +3 −2 Original line number Diff line number Diff line Loading @@ -104,7 +104,7 @@ class Repository(object): ''' try: last_path = os.path.join(config.path, config.lastname) return int(istools.uopen(last_path, "r").read().rstrip()) return int(open(last_path, "r").read().rstrip()) except Exception as e: raise Exception("Read last file failed: %s" % e) return 0 Loading Loading @@ -425,7 +425,8 @@ class RepositoryManager(object): open(filedest, "wb") # get remote last value try: rlast = int(istools.uopen(config.lastpath).read().strip()) rlast = int(istools.uopen(config.lastpath, timeout=self.timeout).read().strip()) # get local last value llast = int(os.stat(filedest).st_mtime) # if repo is out of date, download it Loading installsystems/tools.py +2 −2 Original line number Diff line number Diff line Loading @@ -130,7 +130,7 @@ def abspath(path): else: return None def uopen(path, mode="rb"): def uopen(path, mode="rb", timeout=3): ''' Universal Open Create a file-like object to a file which can be remote Loading @@ -139,7 +139,7 @@ def uopen(path, mode="rb"): if ftype == "file": return open(path, mode) elif ftype == "http" or ftype == "ftp": return urllib2.urlopen(path) return urllib2.urlopen(path, timeout=timeout) else: raise NotImplementedError Loading Loading
installsystems/repository.py +3 −2 Original line number Diff line number Diff line Loading @@ -104,7 +104,7 @@ class Repository(object): ''' try: last_path = os.path.join(config.path, config.lastname) return int(istools.uopen(last_path, "r").read().rstrip()) return int(open(last_path, "r").read().rstrip()) except Exception as e: raise Exception("Read last file failed: %s" % e) return 0 Loading Loading @@ -425,7 +425,8 @@ class RepositoryManager(object): open(filedest, "wb") # get remote last value try: rlast = int(istools.uopen(config.lastpath).read().strip()) rlast = int(istools.uopen(config.lastpath, timeout=self.timeout).read().strip()) # get local last value llast = int(os.stat(filedest).st_mtime) # if repo is out of date, download it Loading
installsystems/tools.py +2 −2 Original line number Diff line number Diff line Loading @@ -130,7 +130,7 @@ def abspath(path): else: return None def uopen(path, mode="rb"): def uopen(path, mode="rb", timeout=3): ''' Universal Open Create a file-like object to a file which can be remote Loading @@ -139,7 +139,7 @@ def uopen(path, mode="rb"): if ftype == "file": return open(path, mode) elif ftype == "http" or ftype == "ftp": return urllib2.urlopen(path) return urllib2.urlopen(path, timeout=timeout) else: raise NotImplementedError Loading