[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #6810 [Flashproxy]: Reduce code duplication across client programs



#6810: Reduce code duplication across client programs
-----------------------------+--------------------------
     Reporter:  dcf          |      Owner:  dcf
         Type:  enhancement  |     Status:  needs_review
     Priority:  minor        |  Milestone:
    Component:  Flashproxy   |    Version:
   Resolution:               |   Keywords:
Actual Points:               |  Parent ID:
       Points:               |
-----------------------------+--------------------------

Comment (by infinity0):

 Replying to [comment:14 dcf]:
 > We have a `setup.py` in the top level already, only for py2exe purposes.
 I would be fine with adding library installation code to it, if that's
 convenient.

 We would need to have two separate setup.py scripts (e.g setup.py and
 setup-common.py), there is no easy way to have the same script act on two
 distinct source packages. However, I think I have found the appropriate
 solution.

 Replying to [comment:14 dcf]:
 > Having to set PYTHONPATH is annoying but probably tolerable. I would
 rather not have an `init-dev-env` script; let's just document that you
 have to set PYTHONPATH. (The name `init-dev-env` is mostly unknown to
 Google--is there some other name commonly used by other projects?)

 `setuptools` supports installing a package in "development mode"
 http://pythonhosted.org/distribute/setuptools.html#development-mode which
 hardlinks a dummy system lib to the current directory. This process is
 reversible.

 {{{
 flashproxy$ ./flashproxy-client
 Traceback (most recent call last):
   File "./flashproxy-client", line 23, in <module>
     from flashproxy.util import parse_addr_spec, format_addr
 ImportError: No module named flashproxy.util
 1

 flashproxy$ ( cd common/ && sudo python setup.py develop )
 running develop
 [..]
 Creating /usr/local/lib/python2.7/dist-packages/flashproxy-common.egg-link
 (link to .)
 [..]

 flashproxy$ ./flashproxy-client
 2013-09-26 17:18:53 VERSION-ERROR no-version
 VERSION-ERROR no-version

 No TOR_PT_MANAGED_TRANSPORT_VER found in environment.
 If you are running flashproxy-client from the command line and not from
 a ClientTransportPlugin configuration line, you must use the --external
 option.
 1

 flashproxy$ ( cd common/ && sudo python setup.py develop --uninstall )
 running develop
 [..]
 Removing /usr/local/lib/python2.7/dist-packages/flashproxy-common.egg-link
 (link to .)
 [..]

 flashproxy$ ./flashproxy-client
 Traceback (most recent call last):
   File "./flashproxy-client", line 23, in <module>
     from flashproxy.util import parse_addr_spec, format_addr
 ImportError: No module named flashproxy.util
 1
 }}}

 This is even better than setting your environment, because it's persistent
 across shell sessions. The only annoyance is you do have to `cd common`
 first, but I can document this.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/6810#comment:16>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs