summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-05-12 17:21:33 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-05-12 17:21:33 +0200
commit0c525f750dad3f57297836ddea02da7d42ad5969 (patch)
tree2df5f1cd3fb29c71386e197ab782a7385b8e42bd
parentMerge branch 'stable' into 0.4.10 (diff)
downloadpyload-0c525f750dad3f57297836ddea02da7d42ad5969.tar.xz
Other import fixes (4)
-rw-r--r--README.md73
-rw-r--r--pyload/Api/__init__.py6
-rwxr-xr-xpyload/Core.py9
-rw-r--r--pyload/plugin/Plugin.py16
-rw-r--r--pyload/plugin/account/OboomCom.py4
-rw-r--r--pyload/plugin/account/SmoozedCom.py4
-rw-r--r--pyload/plugin/addon/ExtractArchive.py8
-rw-r--r--pyload/utils/filters.py4
-rw-r--r--pyload/webui/__init__.py8
-rw-r--r--pyload/webui/app/cnl.py10
-rwxr-xr-xsetup.py10
11 files changed, 74 insertions, 78 deletions
diff --git a/README.md b/README.md
index af224e7f7..5beeea793 100644
--- a/README.md
+++ b/README.md
@@ -55,17 +55,17 @@ Download
> **Note:**
> If you wanna use pyLoad on Windows, it's hightly recommented to install the latest **official** pre-build package for that platform.
-Releases | Download
------------------------------------------------------ | -----------------------------------------------------
-Pre-build packages with changelog | <https://github.com/pyload/pyload/releases>
+Releases | Download
+-------------------------------------- | --------------------------------------
+Pre-build packages with changelog | <https://github.com/pyload/pyload/releases>
Pre-build packages are provided with all the software dependencies required to run pyLoad flawlessly on the referenced platform.
If you choose a source code, at least you need to have the proper Python version installed on your platform before launch pyLoad.
-Source code | Download
------------------------------------------------------ | -----------------------------------------------------
-Latest stable version | <https://github.com/pyload/pyload/archive/stable.zip>
-Latest development version | <https://github.com/pyload/pyload/archive/master.zip>
+Source code | Download
+-------------------------------------- | --------------------------------------
+Latest stable version | <https://github.com/pyload/pyload/archive/stable.zip>
+Latest development version | <https://github.com/pyload/pyload/archive/master.zip>
Installation
@@ -87,41 +87,42 @@ You can install any missing software package from the *Python Package Index* typ
Dependencies
------------
-### Required ###
+> **Note:**
+> Plugins may require additional software packages to run property, see *Optional packages*.
- - **Beaker**
- - **Getch**
- - **MultipartPostHandler**
- - **SafeEval**
- - **bottle**
- - **colorama**
- - **jinja2**
- - **markupsafe**
- - **pycurl** (python-curl)
- - **rename_process**
- - **setuptools**
- - **thrift**
- - **wsgiserver**
+### Required ###
+Package name | Info
+-------------------------------------- | --------------------------------------
+Beaker |
+Getch |
+MultipartPostHandler |
+SafeEval |
+bottle |
+colorama |
+jinja2 |
+markupsafe |
+pycrypto |
+pycurl | python-curl
+rename_process |
+setuptools |
+thrift |
+wsgiserver |
-Some extra features require additional software packages. See below:
### Optional ###
- - **BeautifulSoup** *Few plugins support*
- - **PIL** (python-imaging) *Captcha recognition*
- - **Send2Trash** *Trash support*
- - **colorlog** *Colored log*
- - **bjoern** (<https://github.com/jonashaag/bjoern>) *More responsive web interface*
- - **node.js** *ClickNLoad and other plugins*
- - or **ossp-js**
- - or **pyv8**
- - or **rhino**
- - or **spidermonkey**
- - **pyOpenSSL** *SSL support*
- - **pycrypto** *RSDF/CCF/DLC decrypting*
- - **simplejson** *JSON speedup*
- - **tesseract** *Captcha OCR support*
+Package name | Info
+-------------------------------------- | --------------------------------------
+BeautifulSoup | Few plugins support
+Pillow (or: PIL) | Captcha recognition
+Send2Trash | Trash support
+colorlog | Colored log
+bjoern | More responsive web interface
+node.js (or: ossp-js, pyv8, rhino, spidermonkey) | ClickNLoad and other plugins
+pyOpenSSL | SSL support
+simplejson | JSON speedup
+tesseract | Captcha OCR support
Usage
diff --git a/pyload/Api/__init__.py b/pyload/Api/__init__.py
index 44bae48bc..f4e7d49ee 100644
--- a/pyload/Api/__init__.py
+++ b/pyload/Api/__init__.py
@@ -17,15 +17,15 @@ from pyload.utils import compare_time, freeSpace, safe_filename
if activated:
try:
- from thrift.protocol import TBase
+ import thrift
+
from pyload.remote.thriftbackend.thriftgen.pyload.ttypes import *
from pyload.remote.thriftbackend.thriftgen.pyload.Pyload import Iface
- BaseObject = TBase
+ BaseObject = thrift.protocol.TBase
except ImportError:
from pyload.Api.types import *
-
print "Thrift not imported"
else:
diff --git a/pyload/Core.py b/pyload/Core.py
index 1ec6ee5ed..217d9aff5 100755
--- a/pyload/Core.py
+++ b/pyload/Core.py
@@ -291,19 +291,20 @@ class Core(object):
if self.config.get("permission", "change_group"):
if os.name != "nt":
try:
- from grp import getgrnam
+ import grp
- group = getgrnam(self.config.get("permission", "group"))
+ group = grp.getgrnam(self.config.get("permission", "group"))
os.setgid(group[2])
+
except Exception, e:
print _("Failed changing group: %s") % e
if self.config.get("permission", "change_user"):
if os.name != "nt":
try:
- from pwd import getpwnam
+ import pwd
- user = getpwnam(self.config.get("permission", "user"))
+ user = pwd.getpwnam(self.config.get("permission", "user"))
os.setuid(user[2])
except Exception, e:
print _("Failed changing user: %s") % e
diff --git a/pyload/plugin/Plugin.py b/pyload/plugin/Plugin.py
index 6648c574f..1657ee529 100644
--- a/pyload/plugin/Plugin.py
+++ b/pyload/plugin/Plugin.py
@@ -13,8 +13,8 @@ import urllib
import urlparse
if os.name != "nt":
- from pwd import getpwnam
- from grp import getgrnam
+ import grp
+ import pwd
from pyload.utils import fs_decode, fs_encode, safe_filename, fs_join, encode
@@ -545,9 +545,9 @@ class Plugin(Base):
res = encode(res)
if self.core.debug:
- from inspect import currentframe
+ import inspect
- frame = currentframe()
+ frame = inspect.currentframe()
framefile = fs_join("tmp", self.getClassName(), "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno))
try:
if not os.path.exists(os.path.join("tmp", self.getClassName())):
@@ -622,8 +622,8 @@ class Plugin(Base):
os.makedirs(location, int(self.core.config.get("permission", "folder"), 8))
if self.core.config.get("permission", "change_dl") and os.name != "nt":
- uid = getpwnam(self.core.config.get("permission", "user"))[2]
- gid = getgrnam(self.core.config.get("permission", "group"))[2]
+ uid = pwd.getpwnam(self.core.config.get("permission", "user"))[2]
+ gid = grp.getgrnam(self.core.config.get("permission", "group"))[2]
os.chown(location, uid, gid)
except Exception, e:
@@ -662,8 +662,8 @@ class Plugin(Base):
if self.core.config.get("permission", "change_dl") and os.name != "nt":
try:
- uid = getpwnam(self.core.config.get("permission", "user"))[2]
- gid = getgrnam(self.core.config.get("permission", "group"))[2]
+ uid = pwd.getpwnam(self.core.config.get("permission", "user"))[2]
+ gid = grp.getgrnam(self.core.config.get("permission", "group"))[2]
os.chown(fs_filename, uid, gid)
except Exception, e:
diff --git a/pyload/plugin/account/OboomCom.py b/pyload/plugin/account/OboomCom.py
index 4669ca61e..b140b9282 100644
--- a/pyload/plugin/account/OboomCom.py
+++ b/pyload/plugin/account/OboomCom.py
@@ -4,8 +4,8 @@ try:
from beaker.crypto.pbkdf2 import PBKDF2
except ImportError:
+ import binascii
from beaker.crypto.pbkdf2 import pbkdf2
- from binascii import b2a_hex
class PBKDF2(object):
@@ -16,7 +16,7 @@ except ImportError:
def hexread(self, octets):
- return b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets))
+ return binascii.b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets))
from pyload.utils import json_loads
from pyload.plugin.Account import Account
diff --git a/pyload/plugin/account/SmoozedCom.py b/pyload/plugin/account/SmoozedCom.py
index 63381c20b..ae666b060 100644
--- a/pyload/plugin/account/SmoozedCom.py
+++ b/pyload/plugin/account/SmoozedCom.py
@@ -7,8 +7,8 @@ try:
from beaker.crypto.pbkdf2 import PBKDF2
except ImportError:
+ import binascii
from beaker.crypto.pbkdf2 import pbkdf2
- from binascii import b2a_hex
class PBKDF2(object):
@@ -19,7 +19,7 @@ except ImportError:
def hexread(self, octets):
- return b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets))
+ return binascii.b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets))
from pyload.utils import json_loads
from pyload.plugin.Account import Account
diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py
index 53bf5559d..27e773a8c 100644
--- a/pyload/plugin/addon/ExtractArchive.py
+++ b/pyload/plugin/addon/ExtractArchive.py
@@ -52,8 +52,8 @@ except ImportError:
pass
if os.name != "nt":
- from grp import getgrnam
- from pwd import getpwnam
+ import grp
+ import pwd
from pyload.plugin.Addon import Addon, threaded, Expose
from pyload.plugin.Extractor import ArchiveError, CRCError, PasswordError
@@ -563,8 +563,8 @@ class ExtractArchive(Addon):
os.chmod(f, int(self.config.get("permission", "folder"), 8))
if self.config.get("permission", "change_dl") and os.name != "nt":
- uid = getpwnam(self.config.get("permission", "user"))[2]
- gid = getgrnam(self.config.get("permission", "group"))[2]
+ uid = pwd.getpwnam(self.config.get("permission", "user"))[2]
+ gid = grp.getgrnam(self.config.get("permission", "group"))[2]
os.chown(f, uid, gid)
except Exception, e:
diff --git a/pyload/utils/filters.py b/pyload/utils/filters.py
index 9d4d47c04..7e361623c 100644
--- a/pyload/utils/filters.py
+++ b/pyload/utils/filters.py
@@ -10,7 +10,7 @@ except Exception:
from posixpath import curdir, sep, pardir
- def os.relpath(path, start=curdir):
+ def relpath(path, start=curdir):
"""Return a relative version of a path"""
if not path:
raise ValueError("no path specified")
@@ -51,7 +51,7 @@ def path_make_absolute(path):
def path_make_relative(path):
- p = os.relpath(path)
+ p = relpath(path)
if p[-1] == os.path.sep:
return p
else:
diff --git a/pyload/webui/__init__.py b/pyload/webui/__init__.py
index a0e849a11..e1fe6738f 100644
--- a/pyload/webui/__init__.py
+++ b/pyload/webui/__init__.py
@@ -107,13 +107,13 @@ def run_lightweight(host="0.0.0.0", port="8000"):
def run_threaded(host="0.0.0.0", port="8000", theads=3, cert="", key=""):
- from wsgiserver import CherryPyWSGIServer
+ import wsgiserver
if cert and key:
- CherryPyWSGIServer.ssl_certificate = cert
- CherryPyWSGIServer.ssl_private_key = key
+ wsgiserver.CherryPyWSGIServer.ssl_certificate = cert
+ wsgiserver.CherryPyWSGIServer.ssl_private_key = key
- CherryPyWSGIServer.numthreads = theads
+ wsgiserver.CherryPyWSGIServer.numthreads = theads
from pyload.webui.app.utils import CherryPyWSGI
diff --git a/pyload/webui/app/cnl.py b/pyload/webui/app/cnl.py
index 465e087e5..07b966f5e 100644
--- a/pyload/webui/app/cnl.py
+++ b/pyload/webui/app/cnl.py
@@ -8,20 +8,14 @@ import os
import re
import urllib
+import Crypto
import bottle
from pyload.webui import PYLOAD, DL_ROOT, JS
-try:
- from Crypto.Cipher import AES
-except Exception:
- pass
-
-
def local_check(function):
-
def _view(*args, **kwargs):
if request.environ.get("REMOTE_ADDR", "0") in ("127.0.0.1", "localhost") \
or request.environ.get("HTTP_HOST", "0") in ("127.0.0.1:9666", "localhost:9666"):
@@ -105,7 +99,7 @@ def addcrypted2():
IV = Key
- obj = AES.new(Key, AES.MODE_CBC, IV)
+ obj = Crypto.Cipher.AES.new(Key, Crypto.Cipher.AES.MODE_CBC, IV)
result = obj.decrypt(crypted).replace("\x00", "").replace("\r", "").split("\n")
result = filter(lambda x: x != "", result)
diff --git a/setup.py b/setup.py
index 30d91c6ae..5c7a52819 100755
--- a/setup.py
+++ b/setup.py
@@ -47,28 +47,28 @@ setuptools.setup(
install_requires=[
"Beaker >= 1.6",
+ "Getch",
+ "MultipartPostHandler",
+ "SafeEval",
"bitmath",
"bottle >= 0.10.0",
"colorama",
- "Getch",
"jinja2",
"markupsafe",
- "MultipartPostHandler",
+ "pycrypto",
"pycurl",
"rename_process",
- "SafeEval",
"thrift >= 0.8.0",
"wsgiserver"
],
extras_require={
'Few plugins dependencies': ["BeautifulSoup >= 3.2, < 3.3"],
- 'Captcha recognition' : ["PIL"],
+ 'Captcha recognition' : ["Pillow"],
'Trash support' : ["Send2Trash"],
'Colored log' : ["colorlog"],
'Lightweight webserver' : ["bjoern"],
'SSL support' : ["pyOpenSSL"],
- 'RSDF/CCF/DLC support' : ["pycrypto"],
'JSON speedup' : ["simplejson"]
},