Skip to content

Commit

Permalink
Redo how libraries are imported so they can import each other (should…
Browse files Browse the repository at this point in the history
… fix the hachoir_metadata import bug)
  • Loading branch information
midgetspy committed Jan 20, 2011
1 parent 9a37325 commit 4aa4fa5
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 16 deletions.
5 changes: 4 additions & 1 deletion SickBeard.py
Expand Up @@ -32,6 +32,9 @@
import traceback
import getopt

# allow libraries to import each other
sys.path.append(os.path.join(os.path.dirname(__file__), 'lib'))

import sickbeard

from sickbeard import db
Expand Down Expand Up @@ -95,7 +98,7 @@ def daemonize():
def main():

# do some preliminary stuff
sickbeard.MY_FULLNAME = os.path.normpath(os.path.abspath(sys.argv[0]))
sickbeard.MY_FULLNAME = os.path.normpath(os.path.abspath(__file__))
sickbeard.MY_NAME = os.path.basename(sickbeard.MY_FULLNAME)
sickbeard.PROG_DIR = os.path.dirname(sickbeard.MY_FULLNAME)
sickbeard.MY_ARGS = sys.argv[1:]
Expand Down
2 changes: 1 addition & 1 deletion lib/hachoir_metadata/__init__.py
@@ -1,4 +1,4 @@
from hachoir_metadata.version import VERSION as __version__
from .hachoir_metadata.version import VERSION as __version__
from hachoir_metadata.metadata import extractMetadata

# Just import the module,
Expand Down
2 changes: 1 addition & 1 deletion lib/oauth2/__init__.py
Expand Up @@ -28,7 +28,7 @@
import urlparse
import hmac
import binascii
import lib.httplib2 as httplib2
import httplib2

try:
from urlparse import parse_qs, parse_qsl
Expand Down
4 changes: 2 additions & 2 deletions lib/pythontwitter/__init__.py
Expand Up @@ -42,7 +42,7 @@
except ImportError:
try:
# Python < 2.6
import lib.simplejson as simplejson
import simplejson
except ImportError:
try:
# Google App Engine
Expand All @@ -61,7 +61,7 @@
except ImportError:
from md5 import md5

import lib.oauth2 as oauth
import oauth2 as oauth


CHARACTER_LIMIT = 140
Expand Down
4 changes: 2 additions & 2 deletions lib/simplejson/decoder.py
Expand Up @@ -4,9 +4,9 @@
import sys
import struct

from lib.simplejson.scanner import make_scanner
from simplejson.scanner import make_scanner
try:
from lib.simplejson._speedups import scanstring as c_scanstring
from simplejson._speedups import scanstring as c_scanstring
except ImportError:
c_scanstring = None

Expand Down
4 changes: 2 additions & 2 deletions lib/simplejson/encoder.py
Expand Up @@ -3,11 +3,11 @@
import re

try:
from lib.simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii
from simplejson._speedups import encode_basestring_ascii as c_encode_basestring_ascii
except ImportError:
c_encode_basestring_ascii = None
try:
from lib.simplejson._speedups import make_encoder as c_make_encoder
from simplejson._speedups import make_encoder as c_make_encoder
except ImportError:
c_make_encoder = None

Expand Down
5 changes: 1 addition & 4 deletions lib/tvdb_api/tvdb_api.py
Expand Up @@ -41,10 +41,7 @@


# Use local version for sickbeard, system version elsewhere
try:
import lib.httplib2 as httplib2
except ImportError:
import httplib2 as httplib2
import httplib2

from tvdb_ui import BaseUI, ConsoleUI
from tvdb_exceptions import (tvdb_error, tvdb_userabort, tvdb_shownotfound,
Expand Down
3 changes: 0 additions & 3 deletions sickbeard/image_cache.py
Expand Up @@ -24,9 +24,6 @@
from sickbeard import helpers, logger, exceptions
from sickbeard import encodingKludge as ek

# this is such a hack, I really need to fix this crap
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), 'lib'))

from sickbeard.metadata.generic import GenericMetadata

from lib.hachoir_parser import createParser
Expand Down

0 comments on commit 4aa4fa5

Please sign in to comment.