diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-09-29 13:03:17 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-09-29 13:03:17 +0200 |
commit | 6a997661dc5c259f844531382a90a4ca120f1233 (patch) | |
tree | 085a76d4bac208963649a62f9393e0c0b049e869 /pyload/setup/dependencies.py | |
parent | rewritten decrypter and info fetching thread (diff) | |
download | pyload-6a997661dc5c259f844531382a90a4ca120f1233.tar.xz |
basics for web setup
Diffstat (limited to 'pyload/setup/dependencies.py')
-rw-r--r-- | pyload/setup/dependencies.py | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/pyload/setup/dependencies.py b/pyload/setup/dependencies.py new file mode 100644 index 000000000..53457de93 --- /dev/null +++ b/pyload/setup/dependencies.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +# Provide gettext marker +_ = lambda x: x + + +def find_module(name): + from imp import find_module + + try: + f, pathname, desc = find_module(name) + if f is not None: + f.close() + return True + except: + return False + + +class Dependency(object): + name = None + optional = True + desc = None + + @classmethod + def check(cls): + """ Returns (availability, version) as tuple """ + inst = cls() + avail = inst.isStatisfied() + v = None + if avail: + v = inst.getVersion() + + return avail, v + + def isStatisfied(self): + raise NotImplementedError + + def getVersion(self): + return None + + +class Python(Dependency): + name = "Python" + optional = False + + def isStatisfied(self): + # obviously + return True + + def getVersion(self): + import sys + + ".".join(str(v) for v in sys.version_info[:3]) + + +class JSON(Dependency): + name = "json" + optional = False + + def isStatisfied(self): + # TODO + return True + + +class PyCurl(Dependency): + name = "pycurl" + optional = False + + def isStatisfied(self): + # TODO + return True + + +class Sqlite(Dependency): + name = "sqlite" + optional = False + + def isStatisfied(self): + # TODO + return True + +# TODO: ssl, crypto, image, tesseract, js + +deps = [x for x in locals().itervalues() if issubclass(x, Dependency) and x is not Dependency]
\ No newline at end of file |