diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-20 23:16:39 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-20 23:16:39 +0200 |
commit | 60964880943883de132e248b0deb3aaf8e5e67b5 (patch) | |
tree | 7773600894666c5f8db7ec7a32ddf3f2e8b33c8c | |
parent | setup improvements, UnRar fix (diff) | |
download | pyload-60964880943883de132e248b0deb3aaf8e5e67b5.tar.xz |
some win preparation
-rw-r--r-- | module/plugins/captcha/captcha.py | 9 | ||||
-rw-r--r-- | module/setup.py | 12 | ||||
-rw-r--r-- | module/web/createsuperuser.py | 2 | ||||
-rw-r--r-- | module/web/syncdb.py | 5 | ||||
-rwxr-xr-x | pyLoadCore.py | 10 |
5 files changed, 25 insertions, 13 deletions
diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py index 12486fbc5..ed235246a 100644 --- a/module/plugins/captcha/captcha.py +++ b/module/plugins/captcha/captcha.py @@ -18,6 +18,8 @@ # ### from __future__ import with_statement +import os.name +from os.path import join import logging import subprocess import tempfile @@ -85,7 +87,12 @@ class OCR(object): self.logger.debug("save tiff") self.image.save(tmp.name, 'TIFF') - tessparams = ['tesseract', tmp.name, tmpTxt.name.replace(".txt", "")] + if os.name == "nt": + tessparams = [join(pydir,"tesseract","tesseract.exe")] + else: + tessparams = ['tesseract'] + + tessparams.extend( [tmp.name, tmpTxt.name.replace(".txt", "")] ) if subset and (digits or lowercase or uppercase): #self.logger.debug("create temp subset config") diff --git a/module/setup.py b/module/setup.py index 57ebf598a..96c56edda 100644 --- a/module/setup.py +++ b/module/setup.py @@ -20,6 +20,7 @@ from getpass import getpass import gettext from hashlib import sha1 from os import remove +import os.name from os.path import abspath from os.path import dirname from os.path import isfile @@ -64,7 +65,7 @@ class Setup(): if not basic: print _("You need pycurl, sqlite and python 2.5, 2.6 or 2.7 to run pyLoad.") - print _("Please correct this and re run pyLoad.") + print _("Please correct this and re-run pyLoad.") print _("Setup will now close.") raw_input() return False @@ -191,12 +192,13 @@ class Setup(): pil = self.check_module("Image") self.print_dep("py-imaging", pil) - #@TODO win tesseract - - tesser = self.check_prog(["tesseract", "-v"]) + if os.name == "nt": + tesser = self.check_prog([join(pypath, "tesseract", "tesseract.exe"), "-v"]) + else: + tesser = self.check_prog(["tesseract", "-v"]) + self.print_dep("tesseract", tesser) - captcha = pil and tesser print "" diff --git a/module/web/createsuperuser.py b/module/web/createsuperuser.py index 892069f84..0ff1d15b8 100644 --- a/module/web/createsuperuser.py +++ b/module/web/createsuperuser.py @@ -6,7 +6,7 @@ import os import sys os.environ["DJANGO_SETTINGS_MODULE"] = 'settings' - +sys.path.append(os.path.join(pypath, "module", "web")) import getpass import re diff --git a/module/web/syncdb.py b/module/web/syncdb.py index d7905f2f9..669f22681 100644 --- a/module/web/syncdb.py +++ b/module/web/syncdb.py @@ -5,6 +5,7 @@ import os import sys os.environ["DJANGO_SETTINGS_MODULE"] = 'settings' +sys.path.append(os.path.join(pypath, "module", "web")) from django.conf import settings from django.core.management.base import NoArgsCommand @@ -144,8 +145,8 @@ def handle_noargs(**options): else: transaction.commit_unless_managed(using=db) - from django.core.management import call_command - call_command('loaddata', 'initial_data', verbosity=verbosity, database=db) + #from django.core.management import call_command + #call_command('loaddata', 'initial_data', verbosity=verbosity, database=db) if __name__ == "__main__": handle_noargs()
\ No newline at end of file diff --git a/pyLoadCore.py b/pyLoadCore.py index e1c7331a7..e102d2a3e 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -147,17 +147,19 @@ class Core(object): def start(self): """ starts the fun :D """ - try: signal.signal(signal.SIGQUIT, self.quit) - except: pass - if not exists("pyload.conf"): from module.setup import Setup print "This is your first start, running configuration assistent now." self.config = ConfigParser() s = Setup(pypath, self.config) - s.start() + res = s.start() + if not res: + remove("pyload.conf") exit() + try: signal.signal(signal.SIGQUIT, self.quit) + except: pass + self.config = ConfigParser() translation = gettext.translation("pyLoad", self.path("locale"), languages=["en", self.config['general']['language']]) |