From: david-sarah Date: Fri, 26 Feb 2010 08:14:33 +0000 (-0700) Subject: Change relative imports to absolute X-Git-Tag: trac-4400~71 X-Git-Url: https://git.rkrishnan.org/%5B/frontends/(%5B%5E?a=commitdiff_plain;h=e76092e16c64019857441e9020d6d8ba2bdaa0bc;p=tahoe-lafs%2Ftahoe-lafs.git Change relative imports to absolute --- diff --git a/src/allmydata/__init__.py b/src/allmydata/__init__.py index 8bc32cc9..e098e0eb 100644 --- a/src/allmydata/__init__.py +++ b/src/allmydata/__init__.py @@ -39,7 +39,7 @@ finally: __version__ = "unknown" try: - from _version import __version__ + from allmydata._version import __version__ except ImportError: # We're running in a tree that hasn't run "./setup.py darcsver", and didn't # come with a _version.py, so we don't know what our version is. This should @@ -48,7 +48,7 @@ except ImportError: __appname__ = "unknown" try: - from _appname import __appname__ + from allmydata._appname import __appname__ except ImportError: # We're running in a tree that hasn't run "./setup.py". This shouldn't happen. pass @@ -58,7 +58,7 @@ except ImportError: # http://allmydata.org/trac/tahoe/wiki/Versioning __full_version__ = __appname__ + '/' + str(__version__) -import _auto_deps +from allmydata import _auto_deps _auto_deps.require_auto_deps() import os, platform, re, subprocess, sys diff --git a/src/allmydata/frontends/ftpd.py b/src/allmydata/frontends/ftpd.py index 3caf385e..8e66e437 100644 --- a/src/allmydata/frontends/ftpd.py +++ b/src/allmydata/frontends/ftpd.py @@ -265,7 +265,7 @@ class Handler: d.addCallback(_got_parent) return d -from auth import AccountURLChecker, AccountFileChecker, NeedRootcapLookupScheme +from allmydata.frontends.auth import AccountURLChecker, AccountFileChecker, NeedRootcapLookupScheme class Dispatcher: diff --git a/src/allmydata/frontends/sftpd.py b/src/allmydata/frontends/sftpd.py index 4a866eec..fa52df52 100644 --- a/src/allmydata/frontends/sftpd.py +++ b/src/allmydata/frontends/sftpd.py @@ -402,7 +402,7 @@ class SFTPHandler: # then you get SFTPHandler(user) components.registerAdapter(SFTPHandler, SFTPUser, ISFTPServer) -from auth import AccountURLChecker, AccountFileChecker, NeedRootcapLookupScheme +from allmydata.frontends.auth import AccountURLChecker, AccountFileChecker, NeedRootcapLookupScheme class Dispatcher: implements(portal.IRealm) diff --git a/src/allmydata/gui/confwiz.py b/src/allmydata/gui/confwiz.py index 3f47fb05..48af9b34 100644 --- a/src/allmydata/gui/confwiz.py +++ b/src/allmydata/gui/confwiz.py @@ -24,9 +24,7 @@ from allmydata.util.assertutil import precondition from allmydata.util import hashutil, base32 from allmydata import uri import allmydata - -#import amdicon -import amdlogo +from allmydata.gui import amdlogo from foolscap.api import Tub from twisted.python import usage diff --git a/src/allmydata/gui/macapp.py b/src/allmydata/gui/macapp.py index 96061129..d8fa2342 100644 --- a/src/allmydata/gui/macapp.py +++ b/src/allmydata/gui/macapp.py @@ -18,8 +18,7 @@ import allmydata from allmydata import client from allmydata.gui.confwiz import ConfWizApp, ACCOUNT_PAGE, DEFAULT_SERVER_URL from allmydata.scripts.common import get_aliases -import amdicon -import amdlogo +from allmydata.gui import amdicon, amdlogo DEFAULT_FUSE_TIMEOUT = 300 diff --git a/src/allmydata/introducer/__init__.py b/src/allmydata/introducer/__init__.py index a9cab7e6..6a877edd 100644 --- a/src/allmydata/introducer/__init__.py +++ b/src/allmydata/introducer/__init__.py @@ -2,7 +2,7 @@ # This is for compatibilty with old .tac files, which reference # allmydata.introducer.IntroducerNode -from server import IntroducerNode +from allmydata.introducer.server import IntroducerNode # hush pyflakes _unused = [IntroducerNode] diff --git a/src/allmydata/mutable/checker.py b/src/allmydata/mutable/checker.py index 92ed05d8..e5d3c301 100644 --- a/src/allmydata/mutable/checker.py +++ b/src/allmydata/mutable/checker.py @@ -6,9 +6,9 @@ from allmydata.uri import from_string from allmydata.util import hashutil, base32, idlib, log from allmydata.check_results import CheckAndRepairResults, CheckResults -from common import MODE_CHECK, CorruptShareError -from servermap import ServerMap, ServermapUpdater -from layout import unpack_share, SIGNED_PREFIX_LENGTH +from allmydata.mutable.common import MODE_CHECK, CorruptShareError +from allmydata.mutable.servermap import ServerMap, ServermapUpdater +from allmydata.mutable.layout import unpack_share, SIGNED_PREFIX_LENGTH class MutableChecker: diff --git a/src/allmydata/mutable/filenode.py b/src/allmydata/mutable/filenode.py index be5ca5c2..d9cd9274 100644 --- a/src/allmydata/mutable/filenode.py +++ b/src/allmydata/mutable/filenode.py @@ -12,13 +12,13 @@ from allmydata.uri import WriteableSSKFileURI, ReadonlySSKFileURI from allmydata.monitor import Monitor from pycryptopp.cipher.aes import AES -from publish import Publish -from common import MODE_READ, MODE_WRITE, UnrecoverableFileError, \ +from allmydata.mutable.publish import Publish +from allmydata.mutable.common import MODE_READ, MODE_WRITE, UnrecoverableFileError, \ ResponseCache, UncoordinatedWriteError -from servermap import ServerMap, ServermapUpdater -from retrieve import Retrieve -from checker import MutableChecker, MutableCheckAndRepairer -from repairer import Repairer +from allmydata.mutable.servermap import ServerMap, ServermapUpdater +from allmydata.mutable.retrieve import Retrieve +from allmydata.mutable.checker import MutableChecker, MutableCheckAndRepairer +from allmydata.mutable.repairer import Repairer class BackoffAgent: diff --git a/src/allmydata/mutable/layout.py b/src/allmydata/mutable/layout.py index 40c7174a..9565843f 100644 --- a/src/allmydata/mutable/layout.py +++ b/src/allmydata/mutable/layout.py @@ -1,6 +1,6 @@ import struct -from common import NeedMoreDataError, UnknownVersionError +from allmydata.mutable.common import NeedMoreDataError, UnknownVersionError PREFIX = ">BQ32s16s" # each version has a different prefix SIGNED_PREFIX = ">BQ32s16s BBQQ" # this is covered by the signature diff --git a/src/allmydata/mutable/publish.py b/src/allmydata/mutable/publish.py index 7ff4350d..1b7e050a 100644 --- a/src/allmydata/mutable/publish.py +++ b/src/allmydata/mutable/publish.py @@ -12,10 +12,10 @@ from allmydata.storage.server import si_b2a from pycryptopp.cipher.aes import AES from foolscap.api import eventually, fireEventually -from common import MODE_WRITE, MODE_CHECK, DictOfSets, \ +from allmydata.mutable.common import MODE_WRITE, MODE_CHECK, DictOfSets, \ UncoordinatedWriteError, NotEnoughServersError -from servermap import ServerMap -from layout import pack_prefix, pack_share, unpack_header, pack_checkstring, \ +from allmydata.mutable.servermap import ServerMap +from allmydata.mutable.layout import pack_prefix, pack_share, unpack_header, pack_checkstring, \ unpack_checkstring, SIGNED_PREFIX class PublishStatus: diff --git a/src/allmydata/mutable/retrieve.py b/src/allmydata/mutable/retrieve.py index 9165ebd1..b4fa1c22 100644 --- a/src/allmydata/mutable/retrieve.py +++ b/src/allmydata/mutable/retrieve.py @@ -12,8 +12,8 @@ from allmydata.storage.server import si_b2a from pycryptopp.cipher.aes import AES from pycryptopp.publickey import rsa -from common import DictOfSets, CorruptShareError, UncoordinatedWriteError -from layout import SIGNED_PREFIX, unpack_share_data +from allmydata.mutable.common import DictOfSets, CorruptShareError, UncoordinatedWriteError +from allmydata.mutable.layout import SIGNED_PREFIX, unpack_share_data class RetrieveStatus: implements(IRetrieveStatus) diff --git a/src/allmydata/mutable/servermap.py b/src/allmydata/mutable/servermap.py index f47deaef..3dfb36f2 100644 --- a/src/allmydata/mutable/servermap.py +++ b/src/allmydata/mutable/servermap.py @@ -10,9 +10,9 @@ from allmydata.storage.server import si_b2a from allmydata.interfaces import IServermapUpdaterStatus from pycryptopp.publickey import rsa -from common import MODE_CHECK, MODE_ANYTHING, MODE_WRITE, MODE_READ, \ +from allmydata.mutable.common import MODE_CHECK, MODE_ANYTHING, MODE_WRITE, MODE_READ, \ DictOfSets, CorruptShareError, NeedMoreDataError -from layout import unpack_prefix_and_signature, unpack_header, unpack_share, \ +from allmydata.mutable.layout import unpack_prefix_and_signature, unpack_header, unpack_share, \ SIGNED_PREFIX_LENGTH class UpdateStatus: diff --git a/src/allmydata/scripts/debug.py b/src/allmydata/scripts/debug.py index 6be2cd3d..d18d3cb1 100644 --- a/src/allmydata/scripts/debug.py +++ b/src/allmydata/scripts/debug.py @@ -771,7 +771,8 @@ class ConsolidateOptions(VDriveOptions): self.where = where def consolidate(options): - from consolidate import main; return main(options) + from allmydata.scripts.consolidate import main + return main(options) class DebugCommand(usage.Options): diff --git a/src/allmydata/scripts/runner.py b/src/allmydata/scripts/runner.py index ee8415d5..9db7d05e 100644 --- a/src/allmydata/scripts/runner.py +++ b/src/allmydata/scripts/runner.py @@ -8,7 +8,7 @@ from twisted.python import usage pkg_resources.require('allmydata-tahoe') from allmydata.scripts.common import BaseOptions -import debug, create_node, startstop_node, cli, keygen, stats_gatherer +from allmydata.scripts import debug, create_node, startstop_node, cli, keygen, stats_gatherer def GROUP(s): # Usage.parseOptions compares argv[1] against command[0], so it will diff --git a/src/allmydata/storage/expirer.py b/src/allmydata/storage/expirer.py index bb94e11b..41823e7e 100644 --- a/src/allmydata/storage/expirer.py +++ b/src/allmydata/storage/expirer.py @@ -1,7 +1,7 @@ import time, os, pickle, struct -from crawler import ShareCrawler -from shares import get_share_file -from common import UnknownMutableContainerVersionError, \ +from allmydata.storage.crawler import ShareCrawler +from allmydata.storage.shares import get_share_file +from allmydata.storage.common import UnknownMutableContainerVersionError, \ UnknownImmutableContainerVersionError from twisted.python import log as twlog diff --git a/src/allmydata/storage/shares.py b/src/allmydata/storage/shares.py index c433cfbb..558bddc1 100644 --- a/src/allmydata/storage/shares.py +++ b/src/allmydata/storage/shares.py @@ -1,7 +1,7 @@ #! /usr/bin/python -from mutable import MutableShareFile -from immutable import ShareFile +from allmydata.storage.mutable import MutableShareFile +from allmydata.storage.immutable import ShareFile def get_share_file(filename): f = open(filename, "rb") diff --git a/src/allmydata/test/common.py b/src/allmydata/test/common.py index 054c0fd1..b3784cb3 100644 --- a/src/allmydata/test/common.py +++ b/src/allmydata/test/common.py @@ -21,7 +21,7 @@ from allmydata.util.assertutil import precondition from allmydata.util.consumer import download_to_data from allmydata.stats import StatsGathererService from allmydata.key_generator import KeyGeneratorService -import common_util as testutil +import allmydata.test.common_util as testutil from allmydata import immutable diff --git a/src/allmydata/test/test_checker.py b/src/allmydata/test/test_checker.py index 67e745dd..7548d7cc 100644 --- a/src/allmydata/test/test_checker.py +++ b/src/allmydata/test/test_checker.py @@ -7,7 +7,7 @@ from allmydata.storage_client import StorageFarmBroker, NativeStorageClientDescr from allmydata.monitor import Monitor from allmydata.test.no_network import GridTestMixin from allmydata.immutable.upload import Data -from common_web import WebRenderingMixin +from allmydata.test.common_web import WebRenderingMixin class FakeClient: def get_storage_broker(self): diff --git a/src/allmydata/test/test_client.py b/src/allmydata/test/test_client.py index 61f1e53f..c7ff84c5 100644 --- a/src/allmydata/test/test_client.py +++ b/src/allmydata/test/test_client.py @@ -12,7 +12,7 @@ from allmydata.util import base32, fileutil from allmydata.interfaces import IFilesystemNode, IFileNode, \ IImmutableFileNode, IMutableFileNode, IDirectoryNode from foolscap.api import flushEventualQueue -import common_util as testutil +import allmydata.test.common_util as testutil class FakeIntroducerClient(IntroducerClient): def __init__(self): diff --git a/src/allmydata/test/test_crawler.py b/src/allmydata/test/test_crawler.py index 1c57e134..c4aa9914 100644 --- a/src/allmydata/test/test_crawler.py +++ b/src/allmydata/test/test_crawler.py @@ -10,8 +10,8 @@ from allmydata.util import fileutil, hashutil, pollmixin from allmydata.storage.server import StorageServer, si_b2a from allmydata.storage.crawler import ShareCrawler, TimeSliceExceeded -from test_storage import FakeCanary -from common_util import StallMixin +from allmydata.test.test_storage import FakeCanary +from allmydata.test.common_util import StallMixin class BucketEnumeratingCrawler(ShareCrawler): cpu_slice = 500 # make sure it can complete in a single slice diff --git a/src/allmydata/test/test_dirnode.py b/src/allmydata/test/test_dirnode.py index e6aaf775..5cbc0ac9 100644 --- a/src/allmydata/test/test_dirnode.py +++ b/src/allmydata/test/test_dirnode.py @@ -22,7 +22,7 @@ from allmydata.test.no_network import GridTestMixin from allmydata.unknown import UnknownNode, strip_prefix_for_ro from allmydata.nodemaker import NodeMaker from base64 import b32decode -import common_util as testutil +import allmydata.test.common_util as testutil class MemAccum: implements(IConsumer) diff --git a/src/allmydata/test/test_encode.py b/src/allmydata/test/test_encode.py index 36a854ea..1108e187 100644 --- a/src/allmydata/test/test_encode.py +++ b/src/allmydata/test/test_encode.py @@ -11,7 +11,7 @@ from allmydata.util.consumer import MemoryConsumer from allmydata.interfaces import IStorageBucketWriter, IStorageBucketReader, \ NotEnoughSharesError, IStorageBroker, UploadUnhappinessError from allmydata.monitor import Monitor -import common_util as testutil +import allmydata.test.common_util as testutil class LostPeerError(Exception): pass diff --git a/src/allmydata/test/test_introducer.py b/src/allmydata/test/test_introducer.py index 8da06d3a..9d0f50eb 100644 --- a/src/allmydata/test/test_introducer.py +++ b/src/allmydata/test/test_introducer.py @@ -14,7 +14,7 @@ from allmydata.introducer.server import IntroducerService # test compatibility with old introducer .tac files from allmydata.introducer import IntroducerNode from allmydata.util import pollmixin -import common_util as testutil +import allmydata.test.common_util as testutil class LoggingMultiService(service.MultiService): def log(self, msg, **kw): diff --git a/src/allmydata/test/test_iputil.py b/src/allmydata/test/test_iputil.py index 21550893..88da7baa 100644 --- a/src/allmydata/test/test_iputil.py +++ b/src/allmydata/test/test_iputil.py @@ -2,7 +2,7 @@ import re from twisted.trial import unittest from allmydata.util import iputil -import common_util as testutil +import allmydata.test.common_util as testutil DOTTED_QUAD_RE=re.compile("^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$") diff --git a/src/allmydata/test/test_mutable.py b/src/allmydata/test/test_mutable.py index fa29d342..30d10834 100644 --- a/src/allmydata/test/test_mutable.py +++ b/src/allmydata/test/test_mutable.py @@ -28,7 +28,7 @@ from allmydata.mutable.servermap import ServerMap, ServermapUpdater from allmydata.mutable.layout import unpack_header, unpack_share from allmydata.mutable.repairer import MustForceRepairError -import common_util as testutil +import allmydata.test.common_util as testutil # this "FakeStorage" exists to put the share data in RAM and avoid using real # network connections, both to speed up the tests and to reduce the amount of diff --git a/src/allmydata/test/test_node.py b/src/allmydata/test/test_node.py index 3fa72a0b..24ec5714 100644 --- a/src/allmydata/test/test_node.py +++ b/src/allmydata/test/test_node.py @@ -8,7 +8,7 @@ from foolscap.api import flushEventualQueue from twisted.application import service from allmydata.node import Node, formatTimeTahoeStyle from allmydata.util import fileutil -import common_util as testutil +import allmydata.test.common_util as testutil class LoggingMultiService(service.MultiService): def log(self, msg, **kw): diff --git a/src/allmydata/test/test_repairer.py b/src/allmydata/test/test_repairer.py index 91ab704d..a4ccf2c3 100644 --- a/src/allmydata/test/test_repairer.py +++ b/src/allmydata/test/test_repairer.py @@ -8,7 +8,7 @@ from allmydata.util.consumer import download_to_data from twisted.internet import defer from twisted.trial import unittest import random -from no_network import GridTestMixin +from allmydata.test.no_network import GridTestMixin # We'll allow you to pass this test even if you trigger eighteen times as # many disk reads and block fetches as would be optimal. diff --git a/src/allmydata/test/test_stats.py b/src/allmydata/test/test_stats.py index c2ff496b..3ee49592 100644 --- a/src/allmydata/test/test_stats.py +++ b/src/allmydata/test/test_stats.py @@ -3,7 +3,7 @@ from twisted.trial import unittest from twisted.application import service from allmydata.stats import CPUUsageMonitor from allmydata.util import pollmixin -import common_util as testutil +import allmydata.test.common_util as testutil class FasterMonitor(CPUUsageMonitor): POLL_INTERVAL = 0.1 diff --git a/src/allmydata/test/test_upload.py b/src/allmydata/test/test_upload.py index 7366e8d8..6f4ff374 100644 --- a/src/allmydata/test/test_upload.py +++ b/src/allmydata/test/test_upload.py @@ -13,8 +13,6 @@ from allmydata.immutable import upload, encode from allmydata.interfaces import FileTooLargeError, UploadUnhappinessError from allmydata.util.assertutil import precondition from allmydata.util.deferredutil import DeferredListShouldSucceed -from allmydata.util.happinessutil import servers_of_happiness, \ - shares_by_server, merge_peers from no_network import GridTestMixin from common_util import ShouldFailMixin from allmydata.storage_client import StorageFarmBroker diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 0df0bbed..8fabca34 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -24,7 +24,7 @@ from allmydata.test.common import FakeCHKFileNode, FakeMutableFileNode, \ create_chk_filenode, WebErrorMixin, ShouldFailMixin, make_mutable_file_uri from allmydata.interfaces import IMutableFileNode from allmydata.mutable import servermap, publish, retrieve -import common_util as testutil +import allmydata.test.common_util as testutil from allmydata.test.no_network import GridTestMixin from allmydata.test.common_web import HTTPClientGETFactory, \ HTTPClientHEADFactory diff --git a/src/allmydata/util/assertutil.py b/src/allmydata/util/assertutil.py index f3dfb85b..735f534c 100644 --- a/src/allmydata/util/assertutil.py +++ b/src/allmydata/util/assertutil.py @@ -2,7 +2,7 @@ Tests useful in assertion checking, prints out nicely formated messages too. """ -from humanreadable import hr +from allmydata.util.humanreadable import hr def _assert(___cond=False, *___args, **___kwargs): if ___cond: diff --git a/src/allmydata/util/base32.py b/src/allmydata/util/base32.py index 00424af5..fb8cb635 100644 --- a/src/allmydata/util/base32.py +++ b/src/allmydata/util/base32.py @@ -1,7 +1,7 @@ # from the Python Standard Library import string -from assertutil import precondition +from allmydata.util.assertutil import precondition z_base_32_alphabet = "ybndrfg8ejkmcpqxot1uwisza345h769" # Zooko's choice, rationale in "DESIGN" doc rfc3548_alphabet = "abcdefghijklmnopqrstuvwxyz234567" # RFC3548 standard used by Gnutella, Content-Addressable Web, THEX, Bitzi, Web-Calculus... diff --git a/src/allmydata/util/dictutil.py b/src/allmydata/util/dictutil.py index 3dc815b3..8de136f2 100644 --- a/src/allmydata/util/dictutil.py +++ b/src/allmydata/util/dictutil.py @@ -5,7 +5,7 @@ Tools to mess with dicts. import copy, operator from bisect import bisect_left, insort_left -from assertutil import _assert, precondition +from allmydata.util.assertutil import _assert, precondition def move(k, d1, d2, strict=False): """ diff --git a/src/allmydata/util/iputil.py b/src/allmydata/util/iputil.py index f4b3e3a4..e24066c3 100644 --- a/src/allmydata/util/iputil.py +++ b/src/allmydata/util/iputil.py @@ -9,8 +9,7 @@ from twisted.internet.utils import getProcessOutput from twisted.python.procutils import which from twisted.python import log -# from allmydata.util -import observer +from allmydata.util import observer try: import resource diff --git a/src/allmydata/util/log.py b/src/allmydata/util/log.py index e1487deb..199318c3 100644 --- a/src/allmydata/util/log.py +++ b/src/allmydata/util/log.py @@ -1,4 +1,4 @@ -import nummedobj +from allmydata.util import nummedobj from foolscap.logging import log from twisted.python import log as tw_log diff --git a/src/allmydata/util/nummedobj.py b/src/allmydata/util/nummedobj.py index 97d37066..de3c57d0 100644 --- a/src/allmydata/util/nummedobj.py +++ b/src/allmydata/util/nummedobj.py @@ -1,4 +1,4 @@ -import dictutil +from allmydata.util import dictutil class NummedObj(object): """ diff --git a/src/allmydata/util/repeatable_random.py b/src/allmydata/util/repeatable_random.py index 0fa78e3d..a64445ef 100644 --- a/src/allmydata/util/repeatable_random.py +++ b/src/allmydata/util/repeatable_random.py @@ -35,7 +35,7 @@ def force_repeatability(): time.faketime = faketime time.time = faketime - from idlib import i2b + from allmydata.util.idlib import i2b def fakeurandom(n): if n > 20: z = i2b(random.getrandbits(20*8)) diff --git a/src/allmydata/util/statistics.py b/src/allmydata/util/statistics.py index 71547031..b1e56ef7 100644 --- a/src/allmydata/util/statistics.py +++ b/src/allmydata/util/statistics.py @@ -6,7 +6,7 @@ # Transitive Grace Period Public License, version 1 or later. from __future__ import division -from mathutil import round_sigfigs +from allmydata.util.mathutil import round_sigfigs import math import sys diff --git a/src/allmydata/web/introweb.py b/src/allmydata/web/introweb.py index c405cfd0..28273bd7 100644 --- a/src/allmydata/web/introweb.py +++ b/src/allmydata/web/introweb.py @@ -7,7 +7,7 @@ import allmydata import simplejson from allmydata import get_package_versions_string from allmydata.util import idlib -from common import getxmlfile, get_arg +from allmydata.web.common import getxmlfile, get_arg class IntroducerRoot(rend.Page):