SF.net SVN: fclient: [253] trunk/sandbox/fcp
Status: Pre-Alpha
Brought to you by:
jurner
From: <ju...@us...> - 2008-02-26 09:43:13
|
Revision: 253 http://fclient.svn.sourceforge.net/fclient/?rev=253&view=rev Author: jurner Date: 2008-02-26 01:43:17 -0800 (Tue, 26 Feb 2008) Log Message: ----------- beautified relative importrs Modified Paths: -------------- trunk/sandbox/fcp/fcp2_0_client.py trunk/sandbox/fcp/fcp2_0_config.py trunk/sandbox/fcp/fcp2_0_events.py trunk/sandbox/fcp/fcp2_0_message.py trunk/sandbox/fcp/fcp2_0_params.py trunk/sandbox/fcp/fcp2_0_types.py trunk/sandbox/fcp/fcp2_0_uri.py trunk/sandbox/fcp/scripts/gen_docs.py trunk/sandbox/fcp/scripts/gen_messagecheatsheet.py trunk/sandbox/fcp/test_fcp/test_fcp2_0_client.py trunk/sandbox/fcp/test_fcp/test_fcp2_0_config.py trunk/sandbox/fcp/test_fcp/test_fcp2_0_message.py Modified: trunk/sandbox/fcp/fcp2_0_client.py =================================================================== --- trunk/sandbox/fcp/fcp2_0_client.py 2008-02-26 09:09:30 UTC (rev 252) +++ trunk/sandbox/fcp/fcp2_0_client.py 2008-02-26 09:43:17 UTC (rev 253) @@ -177,16 +177,10 @@ # TODO: check if this is a bug in Fcp # NOTE: seems to be fixed in [build 1112], fixes removed #------------------------------------------------------------------------------------------------------------------------------------------------- - - - - import atexit import copy -import cPickle import logging import os -import random import socket import subprocess import sys @@ -194,31 +188,29 @@ #--> rel import hack -class SysPathHack(object): +class _RelImportHack(object): def __init__(self, n): fpath = os.path.abspath(__file__) for i in xrange(n): fpath = os.path.dirname(fpath) sys.path.insert(0, fpath) def __del__(self): sys.path.pop(0) -hack = SysPathHack(3) +hack = _RelImportHack(2) -from fcp_lib import namespace +import fcp.fcp2_0_consts as consts +from fcp.fcp2_0_events import Events +from fcp.fcp2_0_config import Config +from fcp.fcp2_0_message import Message +import fcp.fcp2_0_params as FcParams +from fcp.fcp2_0_uri import Uri +from fcp.fcp_lib import namespace +from fcp.fcp_lib import tools + del hack #<-- rel import hack -import fcp2_0_consts as consts -from fcp2_0_events import Events -from fcp2_0_config import Config -from fcp2_0_message import Message -import fcp2_0_params as FcParams -from fcp2_0_uri import Uri - -from fcp_lib import tools - - logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) #************************************************************************************************* # Modified: trunk/sandbox/fcp/fcp2_0_config.py =================================================================== --- trunk/sandbox/fcp/fcp2_0_config.py 2008-02-26 09:09:30 UTC (rev 252) +++ trunk/sandbox/fcp/fcp2_0_config.py 2008-02-26 09:43:17 UTC (rev 253) @@ -1,8 +1,24 @@ """Sketch for fcp config tree""" +import os, sys import logging -import fcp2_0_consts as consts -import fcp2_0_types as types + +#--> rel import hack +class _RelImportHack(object): + def __init__(self, n): + fpath = os.path.abspath(__file__) + for i in xrange(n): fpath = os.path.dirname(fpath) + sys.path.insert(0, fpath) + def __del__(self): sys.path.pop(0) +hack = _RelImportHack(2) + +from fcp import fcp2_0_consts as consts +from fcp import fcp2_0_types as types +from fcp.fcp_lib import uuid + + +del hack +#<-- rel import hack #**************************************************************************************** # #**************************************************************************************** Modified: trunk/sandbox/fcp/fcp2_0_events.py =================================================================== --- trunk/sandbox/fcp/fcp2_0_events.py 2008-02-26 09:09:30 UTC (rev 252) +++ trunk/sandbox/fcp/fcp2_0_events.py 2008-02-26 09:43:17 UTC (rev 253) @@ -2,9 +2,23 @@ """ +import os, sys -from fcp_lib import events -import fcp2_0_consts as consts +#--> rel import hack +class _RelImportHack(object): + def __init__(self, n): + fpath = os.path.abspath(__file__) + for i in xrange(n): fpath = os.path.dirname(fpath) + sys.path.insert(0, fpath) + def __del__(self): sys.path.pop(0) +hack = _RelImportHack(2) + +from fcp import fcp2_0_types as types +from fcp.fcp_lib import events + + +del hack +#<-- rel import hack #******************************************************************************* # #******************************************************************************* Modified: trunk/sandbox/fcp/fcp2_0_message.py =================================================================== --- trunk/sandbox/fcp/fcp2_0_message.py 2008-02-26 09:09:30 UTC (rev 252) +++ trunk/sandbox/fcp/fcp2_0_message.py 2008-02-26 09:43:17 UTC (rev 253) @@ -1,11 +1,25 @@ """Freennet Client Protocol message """ - +import os, sys import socket -import fcp2_0_consts as consts -import fcp2_0_types as types +#--> rel import hack +class _RelImportHack(object): + def __init__(self, n): + fpath = os.path.abspath(__file__) + for i in xrange(n): fpath = os.path.dirname(fpath) + sys.path.insert(0, fpath) + def __del__(self): sys.path.pop(0) +hack = _RelImportHack(2) + +from fcp import fcp2_0_consts as consts +from fcp import fcp2_0_types as types +from fcp.fcp_lib import uuid + + +del hack +#<-- rel import hack #******************************************************************************** # #******************************************************************************** Modified: trunk/sandbox/fcp/fcp2_0_params.py =================================================================== --- trunk/sandbox/fcp/fcp2_0_params.py 2008-02-26 09:09:30 UTC (rev 252) +++ trunk/sandbox/fcp/fcp2_0_params.py 2008-02-26 09:43:17 UTC (rev 253) @@ -5,18 +5,17 @@ import time #--> rel import hack -class SysPathHack(object): +class _RelImportHack(object): def __init__(self, n): fpath = os.path.abspath(__file__) for i in xrange(n): fpath = os.path.dirname(fpath) sys.path.insert(0, fpath) def __del__(self): sys.path.pop(0) -hack = SysPathHack(3) +hack = _RelImportHack(2) +from fcp.fcp_lib import uuid -from fcp_lib import uuid - del hack #<-- rel import hack #********************************************************************************************* Modified: trunk/sandbox/fcp/fcp2_0_types.py =================================================================== --- trunk/sandbox/fcp/fcp2_0_types.py 2008-02-26 09:09:30 UTC (rev 252) +++ trunk/sandbox/fcp/fcp2_0_types.py 2008-02-26 09:43:17 UTC (rev 253) @@ -4,26 +4,24 @@ """ import os, sys +import base64 #--> rel import hack -class SysPathHack(object): +class _RelImportHack(object): def __init__(self, n): fpath = os.path.abspath(__file__) for i in xrange(n): fpath = os.path.dirname(fpath) sys.path.insert(0, fpath) def __del__(self): sys.path.pop(0) -hack = SysPathHack(3) +hack =_RelImportHack(2) +from fcp import fcp2_0_consts as consts +from fcp.fcp_lib import numbers -from fcp_lib import numbers - del hack #<-- rel import hack -import base64 - -import fcp2_0_consts as consts #************************************************************************************* # #************************************************************************************* Modified: trunk/sandbox/fcp/fcp2_0_uri.py =================================================================== --- trunk/sandbox/fcp/fcp2_0_uri.py 2008-02-26 09:09:30 UTC (rev 252) +++ trunk/sandbox/fcp/fcp2_0_uri.py 2008-02-26 09:43:17 UTC (rev 253) @@ -1,10 +1,26 @@ """Freennet Client Protocol uri and related methods""" +import os, sys import base64 import re import urlparse -import fcp2_0_consts as consts +#--> rel import hack +class _RelImportHack(object): + def __init__(self, n): + fpath = os.path.abspath(__file__) + for i in xrange(n): fpath = os.path.dirname(fpath) + sys.path.insert(0, fpath) + def __del__(self): sys.path.pop(0) +hack = _RelImportHack(2) + + +from fcp import fcp2_0_consts as consts + + +del hack +#<-- rel import hack + #************************************************************************************** # freenet base64 for keys #************************************************************************************** Modified: trunk/sandbox/fcp/scripts/gen_docs.py =================================================================== --- trunk/sandbox/fcp/scripts/gen_docs.py 2008-02-26 09:09:30 UTC (rev 252) +++ trunk/sandbox/fcp/scripts/gen_docs.py 2008-02-26 09:43:17 UTC (rev 253) @@ -12,8 +12,20 @@ from epydoc import cli import subprocess -import fcpscripts_consts as consts -import gen_messagecheatsheet +#--> rel import hack +class _RelImportHack(object): + def __init__(self, n): + fpath = os.path.abspath(__file__) + for i in xrange(n): fpath = os.path.dirname(fpath) + sys.path.insert(0, fpath) + def __del__(self): sys.path.pop(0) +hack = _RelImportHack(3) + +from fcp.scripts import fcpscripts_consts as consts + + +del hack +#<-- rel import hack #************************************************************************************** # #************************************************************************************** Modified: trunk/sandbox/fcp/scripts/gen_messagecheatsheet.py =================================================================== --- trunk/sandbox/fcp/scripts/gen_messagecheatsheet.py 2008-02-26 09:09:30 UTC (rev 252) +++ trunk/sandbox/fcp/scripts/gen_messagecheatsheet.py 2008-02-26 09:43:17 UTC (rev 253) @@ -23,7 +23,20 @@ import urllib from xml.etree import cElementTree as ET -import fcpscripts_consts as consts +#--> rel import hack +class _RelImportHack(object): + def __init__(self, n): + fpath = os.path.abspath(__file__) + for i in xrange(n): fpath = os.path.dirname(fpath) + sys.path.insert(0, fpath) + def __del__(self): sys.path.pop(0) +hack = _RelImportHack(3) + +from fcp.scripts import fcpscripts_consts as consts + + +del hack +#<-- rel import hack #******************************************************************************* # #******************************************************************************* Modified: trunk/sandbox/fcp/test_fcp/test_fcp2_0_client.py =================================================================== --- trunk/sandbox/fcp/test_fcp/test_fcp2_0_client.py 2008-02-26 09:09:30 UTC (rev 252) +++ trunk/sandbox/fcp/test_fcp/test_fcp2_0_client.py 2008-02-26 09:43:17 UTC (rev 253) @@ -9,20 +9,19 @@ import unittest #--> rel import hack -class SysPathHack(object): +class _RelImportHack(object): def __init__(self, n): fpath = os.path.abspath(__file__) for i in xrange(n): fpath = os.path.dirname(fpath) sys.path.insert(0, fpath) def __del__(self): sys.path.pop(0) -hack = SysPathHack(2) +hack = _RelImportHack(3) +from fcp import fcp2_0_client +from fcp.fcp2_0_client import FcpClient +from fcp import fcp2_0_consts as consts -import fcp2_0_client -from fcp2_0_client import FcpClient -import fcp2_0_consts as consts - del hack #<-- rel import hack Modified: trunk/sandbox/fcp/test_fcp/test_fcp2_0_config.py =================================================================== --- trunk/sandbox/fcp/test_fcp/test_fcp2_0_config.py 2008-02-26 09:09:30 UTC (rev 252) +++ trunk/sandbox/fcp/test_fcp/test_fcp2_0_config.py 2008-02-26 09:43:17 UTC (rev 253) @@ -5,24 +5,21 @@ import unittest #--> rel import hack -def parentdir(n, fpath): - fpath = os.path.abspath(fpath) - for i in xrange(n): - fpath = os.path.dirname(fpath) - return fpath -sys.path.insert(0, parentdir(2, __file__)) +class _RelImportHack(object): + def __init__(self, n): + fpath = os.path.abspath(__file__) + for i in xrange(n): fpath = os.path.dirname(fpath) + sys.path.insert(0, fpath) + def __del__(self): sys.path.pop(0) +hack = _RelImportHack(3) - -from fcp2_0_client import FcpClient +from fcp.fcp2_0_client import FcpClient Message = FcpClient.Message -import fcp2_0_types as types +from fcp import fcp2_0_types as types - -sys.path.pop(0) -del parentdir +del hack #<-- rel import hack - from dummy_socket import DummySocket #**************************************************************************************** # Modified: trunk/sandbox/fcp/test_fcp/test_fcp2_0_message.py =================================================================== --- trunk/sandbox/fcp/test_fcp/test_fcp2_0_message.py 2008-02-26 09:09:30 UTC (rev 252) +++ trunk/sandbox/fcp/test_fcp/test_fcp2_0_message.py 2008-02-26 09:43:17 UTC (rev 253) @@ -5,19 +5,19 @@ import unittest #--> rel import hack -class SysPathHack(object): +class _RelImportHack(object): def __init__(self, n): fpath = os.path.abspath(__file__) for i in xrange(n): fpath = os.path.dirname(fpath) sys.path.insert(0, fpath) def __del__(self): sys.path.pop(0) -hack = SysPathHack(2) +hack = _RelImportHack(3) - -from fcp2_0_client import FcpClient +from fcp.fcp2_0_client import FcpClient Message = FcpClient.Message -import fcp2_0_consts as consts +from fcp import fcp2_0_consts as consts + del hack #<-- rel import hack This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |