[tahoe-lafs-trac-stream] [Tahoe-LAFS] #1539: stop putting pkg_resources.require() into .tac files

Tahoe-LAFS trac at tahoe-lafs.org
Thu Mar 20 18:23:50 UTC 2014


#1539: stop putting pkg_resources.require() into .tac files
-------------------------+-------------------------------------------------
     Reporter:  zooko    |      Owner:  remyroy
         Type:           |     Status:  assigned
  enhancement            |  Milestone:  1.11.0
     Priority:  major    |    Version:  1.9.0a1
    Component:  code-    |   Keywords:  forward-compatibility appname tac
  nodeadmin              |  packaging setuptools review-needed
   Resolution:           |
Launchpad Bug:           |
-------------------------+-------------------------------------------------

Comment (by daira):

 I would prefer to keep the `pkg_resources` import just because:
 * removing it isn't necessary for the purpose of this patch;
 * importing `pkg_resources` can change `sys.path`, which can change where
 `allmydata` is imported from.

 If the `.tac` file is run via `tahoe start` or `tahoe run`, then
 `pkg_resources` will already have been imported and therefore importing it
 again will have no effect -- but this is dependent on the current
 implementation of `tahoe start`/`run`. If the `.tac` were run directly via
 `twistd` or another Python application, then this could have an effect. It
 is never correct to import `allmydata` ''and then'' have the `sys.path`
 change as a result of importing `pkg_resources`, so it is safer to import
 it first. (When we switch to not using the contents of the `.tac` files,
 it won't matter either way, but we're not doing that yet.)

--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1539#comment:14>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list