Rev 3231: (bialix) bzr.exe: move builtin plugins out of library.zip in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sat Feb 23 14:10:30 GMT 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3231
revision-id:pqm at pqm.ubuntu.com-20080223141021-zgxlzjmg5c0hym5n
parent: pqm at pqm.ubuntu.com-20080223121051-ntecw60563jadb3s
parent: bialix at ukr.net-20080223122738-t0o7ks71xmfyr46t
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2008-02-23 14:10:21 +0000
message:
  (bialix) bzr.exe: move builtin plugins out of library.zip
removed:
  index.txt                      index.txt-20071121073725-0corxykv5irjal00-1
added:
  tools/package_mf.py            package_mf.py-20080206141953-323gd0qb2z3tn5pc-1
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
  bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
  setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
  tools/win32/bzr.iss.cog        bzr.iss.cog-20060622100836-b3yup582rt3y0nvm-5
    ------------------------------------------------------------
    revno: 3193.7.12
    revision-id:bialix at ukr.net-20080223122738-t0o7ks71xmfyr46t
    parent: bialix at ukr.net-20080220103615-uxw9jc9m6l63ea27
    parent: pqm at pqm.ubuntu.com-20080223121051-ntecw60563jadb3s
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: plugins.for.bzr.exe
    timestamp: Sat 2008-02-23 14:27:38 +0200
    message:
      merge bzr.dev
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_version.py test_version.py-20070312060045-ol7th9z035r3im3d-1
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 3193.7.11
    revision-id:bialix at ukr.net-20080220103615-uxw9jc9m6l63ea27
    parent: bialix at ukr.net-20080207075319-d9jj7as8i5ztiff7
    parent: pqm at pqm.ubuntu.com-20080220014008-9appc9kw4rjg8v1k
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: plugins.for.bzr.exe
    timestamp: Wed 2008-02-20 12:36:15 +0200
    message:
      merge bzr.dev; update patch for 1.3
    added:
      doc/developers/development-repo.txt developmentrepo.txt-20080102200205-raj42k61dch8pjmj-1
    modified:
      .bzrignore                     bzrignore-20050311232317-81f7b71efa2db11a
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzr                            bzr.py-20050313053754-5485f144c7006fa6
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/bundle/commands.py      __init__.py-20050617152058-1b6530d9ab85c11c
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/info.py                 info.py-20050323235939-6bbfe7d9700b0b9b
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
      bzrlib/plugins/launchpad/__init__.py __init__.py-20060315182712-2d5feebd2a1032dc
      bzrlib/plugins/launchpad/lp_indirect.py lp_indirect.py-20070126012204-de5rugwlt22c7u7e-1
      bzrlib/plugins/launchpad/lp_registration.py lp_registration.py-20060315190948-daa617eafe3a8d48
      bzrlib/plugins/launchpad/test_lp_indirect.py test_lp_indirect.py-20070126002743-oyle362tzv9cd8mi-1
      bzrlib/progress.py             progress.py-20050610070202-df9faaab791964c0
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repofmt/weaverepo.py    presplitout.py-20070125045333-wfav3tsh73oxu3zk-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/smart/bzrdir.py         bzrdir.py-20061122024551-ol0l0o0oofsu9b3t-1
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
      bzrlib/smart/protocol.py       protocol.py-20061108035435-ot0lstk2590yqhzr-1
      bzrlib/smart/repository.py     repository.py-20061128022038-vr5wy5bubyb8xttk-1
      bzrlib/smart/request.py        request.py-20061108095550-gunadhxmzkdjfeek-1
      bzrlib/symbol_versioning.py    symbol_versioning.py-20060105104851-9ecf8af605d15a80
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_bundle_info.py test_bundle_info.py-20070816181255-eiuodwxuqu7w7gxf-1
      bzrlib/tests/blackbox/test_version_info.py test_bb_version_info.py-20051228204928-91711c6559d952f7
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
      bzrlib/tests/test_dirstate.py  test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_info.py      test_info.py-20070320150933-m0xxm1g7xi9v6noe-1
      bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
      bzrlib/tests/test_progress.py  test_progress.py-20060308160359-978c397bc79b7fda
      bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
      bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
      bzrlib/tests/test_revisionnamespaces.py testrevisionnamespaces.py-20050711050225-8b4af89e6b1efe84
      bzrlib/tests/test_smart.py     test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
      bzrlib/tests/test_trace.py     testtrace.py-20051110225523-a21117fc7a07eeff
      bzrlib/tests/test_version_info.py test_version_info.py-20051228204928-2c364e30b702b41b
      bzrlib/tests/test_workingtree_4.py test_workingtree_4.p-20070223025758-531n3tznl3zacv2o-1
      bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
      bzrlib/version_info_formats/format_custom.py format_custom.py-20071029100350-ajovqhbpb5khf6gu-1
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
    ------------------------------------------------------------
    revno: 3193.7.10
    revision-id:bialix at ukr.net-20080207075319-d9jj7as8i5ztiff7
    parent: bialix at ukr.net-20080206153312-qycs7u05d7fjtwqq
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: plugins.for.bzr.exe
    timestamp: Thu 2008-02-07 09:53:19 +0200
    message:
      some cleanup in package_mf.py; mention about load_from_zip() deprecation in NEWS.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      tools/package_mf.py            package_mf.py-20080206141953-323gd0qb2z3tn5pc-1
    ------------------------------------------------------------
    revno: 3193.7.9
    revision-id:bialix at ukr.net-20080206153312-qycs7u05d7fjtwqq
    parent: bialix at ukr.net-20080206145651-h5slxbso5ge20gz1
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: plugins.for.bzr.exe
    timestamp: Wed 2008-02-06 17:33:12 +0200
    message:
      Ian's review
    modified:
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
      tools/win32/bzr.iss.cog        bzr.iss.cog-20060622100836-b3yup582rt3y0nvm-5
    ------------------------------------------------------------
    revno: 3193.7.8
    revision-id:bialix at ukr.net-20080206145651-h5slxbso5ge20gz1
    parent: bialix at ukr.net-20080206143931-d6opyuqsg4tvxd7q
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: plugins.for.bzr.exe
    timestamp: Wed 2008-02-06 16:56:51 +0200
    message:
      update NEWS
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 3193.7.7
    revision-id:bialix at ukr.net-20080206143931-d6opyuqsg4tvxd7q
    parent: bialix at ukr.net-20080206134353-hmkib323nxgq3tw6
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: plugins.for.bzr.exe
    timestamp: Wed 2008-02-06 16:39:31 +0200
    message:
      custom module finder to find additional dependencies for built-in plugins (to bundle additional packages and modules into bzr.exe's library.zip)
    added:
      tools/package_mf.py            package_mf.py-20080206141953-323gd0qb2z3tn5pc-1
    modified:
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
    ------------------------------------------------------------
    revno: 3193.7.6
    revision-id:bialix at ukr.net-20080206134353-hmkib323nxgq3tw6
    parent: bialix at ukr.net-20080120223411-b8vfnw5y7p8b0vhp
    parent: pqm at pqm.ubuntu.com-20080201053934-q32y2nk5vvo13c6v
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: plugins.for.bzr.exe
    timestamp: Wed 2008-02-06 15:43:53 +0200
    message:
      merge bzr.dev
    removed:
      bzrlib/plugins/multiparent.py  mpregen-20070411063203-5x9z7i73add0d6f6-1
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/annotate.py             annotate.py-20050922133147-7c60541d2614f022
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
      bzrlib/debug.py                debug.py-20061102062349-vdhrw9qdpck8cl35-1
      bzrlib/delta.py                delta.py-20050729221636-54cf14ef94783d0a
      bzrlib/doc/api/__init__.py     __init__.py-20051224020744-7b87d590843855bc
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/inventory.py            inventory.py-20050309040759-6648b84ca2005b37
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/merge.py                merge.py-20050513021216-953b65a438527106
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
      bzrlib/plugins/launchpad/__init__.py __init__.py-20060315182712-2d5feebd2a1032dc
      bzrlib/plugins/launchpad/lp_registration.py lp_registration.py-20060315190948-daa617eafe3a8d48
      bzrlib/plugins/launchpad/test_register.py test_register.py-20060315182712-40f5dda945c829a8
      bzrlib/reconfigure.py          reconfigure.py-20070908040425-6ykgo7escxhyrg9p-1
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/smart/client.py         client.py-20061116014825-2k6ada6xgulslami-1
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
      bzrlib/smart/protocol.py       protocol.py-20061108035435-ot0lstk2590yqhzr-1
      bzrlib/status.py               status.py-20050505062338-431bfa63ec9b19e6
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_outside_wt.py test_outside_wt.py-20060116200058-98edd33e7db8bdde
      bzrlib/tests/blackbox/test_pull.py test_pull.py-20051201144907-64959364f629947f
      bzrlib/tests/blackbox/test_selftest.py test_selftest.py-20060123024542-01c5f1bbcb596d78
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_diff.py      testdiff.py-20050727164403-d1a3496ebb12e339
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
      bzrlib/tests/test_merge.py     testmerge.py-20050905070950-c1b5aa49ff911024
      bzrlib/tests/test_nonascii.py  testnonascii.py-20051018022645-ea1d8b6477b058a6
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
      bzrlib/tests/test_reconfigure.py test_reconfigure.py-20070908040425-6ykgo7escxhyrg9p-2
      bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
      bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
      bzrlib/tests/test_trace.py     testtrace.py-20051110225523-a21117fc7a07eeff
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/tests/workingtree_implementations/test_rename_one.py test_rename_one.py-20070226161242-2d8ibdedl700jgio-1
      bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 3193.7.5
    revision-id:bialix at ukr.net-20080120223411-b8vfnw5y7p8b0vhp
    parent: bialix at ukr.net-20080120220828-lfbqgmpqi7bloog2
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: plugins.for.bzr.exe
    timestamp: Mon 2008-01-21 00:34:11 +0200
    message:
      deprecate bzrlib.plugins.load_from_zip feature; remove 0.91-deprecated function all_plugins()
    modified:
      bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
      bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
    ------------------------------------------------------------
    revno: 3193.7.4
    revision-id:bialix at ukr.net-20080120220828-lfbqgmpqi7bloog2
    parent: bialix at ukr.net-20080120215138-9whefgyqt8rfdcbb
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: plugins.for.bzr.exe
    timestamp: Mon 2008-01-21 00:08:28 +0200
    message:
      update script for windows installer
    modified:
      tools/win32/bzr.iss.cog        bzr.iss.cog-20060622100836-b3yup582rt3y0nvm-5
    ------------------------------------------------------------
    revno: 3193.7.3
    revision-id:bialix at ukr.net-20080120215138-9whefgyqt8rfdcbb
    parent: bialix at ukr.net-20080120214833-pys4tt50avj6ml4n
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: plugins.for.bzr.exe
    timestamp: Sun 2008-01-20 23:51:38 +0200
    message:
      bzr.exe: move builtin plugins (launchpad, multiparent) out of library.zip to plugins directory
    modified:
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
    ------------------------------------------------------------
    revno: 3193.7.2
    revision-id:bialix at ukr.net-20080120214833-pys4tt50avj6ml4n
    parent: bialix at ukr.net-20080120203253-wnra9hhip9jv962e
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: plugins.for.bzr.exe
    timestamp: Sun 2008-01-20 23:48:33 +0200
    message:
      removed junk file ./index.txt
    removed:
      index.txt                      index.txt-20071121073725-0corxykv5irjal00-1
    ------------------------------------------------------------
    revno: 3193.7.1
    revision-id:bialix at ukr.net-20080120203253-wnra9hhip9jv962e
    parent: pqm at pqm.ubuntu.com-20080118055224-sskoia4bcpxd8wzu
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: plugins.for.bzr.exe
    timestamp: Sun 2008-01-20 22:32:53 +0200
    message:
      system-wide plugins for bzr.exe works even if BZR_PLUGIN_PATH env variable is set.
    modified:
      bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
=== removed file 'index.txt'
=== added file 'tools/package_mf.py'
--- a/tools/package_mf.py	1970-01-01 00:00:00 +0000
+++ b/tools/package_mf.py	2008-02-07 07:53:19 +0000
@@ -0,0 +1,89 @@
+# Copyright (C) 2008 Canonical Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+"""Custom module finder for entire package"""
+
+import modulefinder
+import os
+import sys
+
+
+class CustomModuleFinder(modulefinder.ModuleFinder):
+    """Custom module finder for processing python packages,
+    e.g. bzr plugins packages.
+
+    :param  path:   list of directories to search for modules;
+                    if not specified, python standard library only is used.
+    """
+
+    def __init__(self, path=None, debug=0, excludes=[], replace_paths=[]):
+        if path is None:
+            path = [os.path.dirname(os.__file__)]    # only python std lib
+        modulefinder.ModuleFinder.__init__(self, path, debug, excludes,
+            replace_paths)
+
+    def run_package(self, package_path):
+        """Recursively process each module in package with run_script method.
+
+        :param  package_path:   path to package directory.
+        """
+        stack = [package_path]
+        while stack:
+            curdir = stack.pop(0)
+            py = os.listdir(curdir)
+            for i in py:
+                full = os.path.join(curdir, i)
+                if os.path.isdir(full):
+                    init = os.path.join(full, '__init__.py')
+                    if os.path.isfile(init):
+                        stack.append(full)
+                    continue
+                if not i.endswith('.py'):
+                    continue
+                if i == 'setup.py':     # skip
+                    continue
+                self.run_script(full)
+
+    def get_result(self):
+        """Return 2-tuple: (list of packages, list of modules)"""
+        keys = self.modules.keys()
+        keys.sort()
+        mods = []
+        packs = []
+        for key in keys:
+            m = self.modules[key]
+            if not m.__file__:      # skip builtins
+                continue
+            if m.__path__:
+                packs.append(key)
+            elif key != '__main__':
+                mods.append(key)
+        return (packs, mods)
+
+
+if __name__ == '__main__':
+    package = sys.argv[1]
+
+    mf = CustomModuleFinder()
+    mf.run_package(package)
+
+    packs, mods = mf.get_result()
+
+    print 'Packages:'
+    print packs
+
+    print 'Modules:'
+    print mods

=== modified file 'NEWS'
--- a/NEWS	2008-02-23 10:24:09 +0000
+++ b/NEWS	2008-02-23 12:27:38 +0000
@@ -24,6 +24,11 @@
       for .bzr.log trace file is ``$BZR_HOME/.bzr.log``.
       (Alexander Belchenko)
 
+    * ``launchpad`` builtin plugin now shipped as separate part in standalone
+      bzr.exe, installed to ``C:\Program Files\Bazaar\plugins`` directory, 
+      and standalone installer allows user to skip installation of this plugin.
+      (Alexander Belchenko)
+
   FEATURES:
 
   IMPROVEMENTS:
@@ -38,10 +43,19 @@
 
   API BREAKS:
 
+    * Support for loading plugins from zip files and
+      ``bzrlib.plugin.load_from_zip()`` function are deprecated.
+      (Alexander Belchenko)
+
   TESTING:
 
   INTERNALS:
 
+    * New module ``tools/package_mf.py`` provide custom module finder for
+      python packages (improves standard python library's modulefinder.py)
+      used by ``setup.py`` script while building standalone bzr.exe.
+      (Alexander Belchenko)
+
     * New remote method ``RemoteBzrDir.find_repositoryV2`` adding support for
       detecting external lookup support on remote repositories. This method is
       now attempted first when lookup up repositories, leading to an extra 
@@ -227,7 +241,7 @@
 
     * Record a timestamp against each mutter to the trace file, relative to the
       first import of bzrlib.  (Andrew Bennetts)
-     
+
     * ``Repository.get_data_stream`` is now deprecated in favour of
       ``Repository.get_data_stream_for_search`` which allows less network
       traffic when requesting data streams over a smart server. (Robert Collins)

=== modified file 'bzrlib/plugin.py'
--- a/bzrlib/plugin.py	2008-01-21 10:46:32 +0000
+++ b/bzrlib/plugin.py	2008-02-20 10:36:15 +0000
@@ -46,7 +46,7 @@
 from bzrlib import plugins as _mod_plugins
 """)
 
-from bzrlib.symbol_versioning import deprecated_function, zero_ninetyone
+from bzrlib.symbol_versioning import deprecated_function, one_three
 from bzrlib.trace import mutter, warning, log_exception_quietly
 
 
@@ -57,30 +57,10 @@
     """Get the DEFAULT_PLUGIN_PATH"""
     global DEFAULT_PLUGIN_PATH
     if DEFAULT_PLUGIN_PATH is None:
-        path = [osutils.pathjoin(config.config_dir(), 'plugins')]
-        if getattr(sys, 'frozen', None):    # bzr.exe
-            # We need to use relative path to system-wide plugin
-            # directory because bzrlib from standalone bzr.exe
-            # could be imported by another standalone program
-            # (e.g. bzr-config; or TortoiseBzr/Olive if/when they
-            # will become standalone exe). [bialix 20071123]
-            # __file__ typically is
-            # C:\Program Files\Bazaar\lib\library.zip\bzrlib\plugin.pyc
-            # then plugins directory is
-            # C:\Program Files\Bazaar\plugins
-            # so relative path is ../../../plugins
-            path.append(osutils.abspath(osutils.pathjoin(
-                osutils.dirname(__file__), '../../../plugins')))
-        DEFAULT_PLUGIN_PATH = os.pathsep.join(path)
+        DEFAULT_PLUGIN_PATH = osutils.pathjoin(config.config_dir(), 'plugins')
     return DEFAULT_PLUGIN_PATH
 
 
- at deprecated_function(zero_ninetyone)
-def all_plugins():
-    """Return a dictionary of the plugins."""
-    return dict((name, plugin.module) for name, plugin in plugins().items())
-
-
 def disable_plugins():
     """Disable loading plugins.
 
@@ -100,11 +80,26 @@
     """Set the path for plugins to be loaded from."""
     path = os.environ.get('BZR_PLUGIN_PATH',
                           get_default_plugin_path()).split(os.pathsep)
+    bzr_exe = bool(getattr(sys, 'frozen', None))
+    if bzr_exe:    # expand path for bzr.exe
+        # We need to use relative path to system-wide plugin
+        # directory because bzrlib from standalone bzr.exe
+        # could be imported by another standalone program
+        # (e.g. bzr-config; or TortoiseBzr/Olive if/when they
+        # will become standalone exe). [bialix 20071123]
+        # __file__ typically is
+        # C:\Program Files\Bazaar\lib\library.zip\bzrlib\plugin.pyc
+        # then plugins directory is
+        # C:\Program Files\Bazaar\plugins
+        # so relative path is ../../../plugins
+        path.append(osutils.abspath(osutils.pathjoin(
+            osutils.dirname(__file__), '../../../plugins')))
     # Get rid of trailing slashes, since Python can't handle them when
     # it tries to import modules.
     path = map(_strip_trailing_sep, path)
-    # search the plugin path before the bzrlib installed dir
-    path.append(os.path.dirname(_mod_plugins.__file__))
+    if not bzr_exe:     # don't look inside library.zip
+        # search the plugin path before the bzrlib installed dir
+        path.append(os.path.dirname(_mod_plugins.__file__))
     _mod_plugins.__path__ = path
     return path
 
@@ -154,9 +149,6 @@
         mutter('looking for plugins in %s', d)
         if os.path.isdir(d):
             load_from_dir(d)
-        else:
-            # it might be a zip: try loading from the zip.
-            load_from_zip(d)
 
 
 # backwards compatability: load_from_dirs was the old name
@@ -215,11 +207,11 @@
             log_exception_quietly()
 
 
+ at deprecated_function(one_three)
 def load_from_zip(zip_name):
     """Load all the plugins in a zip."""
     valid_suffixes = ('.py', '.pyc', '.pyo')    # only python modules/packages
                                                 # is allowed
-
     try:
         index = zip_name.rindex('.zip')
     except ValueError:

=== modified file 'bzrlib/tests/test_plugins.py'
--- a/bzrlib/tests/test_plugins.py	2008-01-21 10:46:32 +0000
+++ b/bzrlib/tests/test_plugins.py	2008-02-20 10:36:15 +0000
@@ -31,7 +31,7 @@
 import bzrlib.plugins
 import bzrlib.commands
 import bzrlib.help
-from bzrlib.symbol_versioning import zero_ninetyone
+from bzrlib.symbol_versioning import one_three
 from bzrlib.tests import TestCase, TestCaseInTempDir
 from bzrlib.osutils import pathjoin, abspath, normpath
 
@@ -214,30 +214,6 @@
         stream.close()
 
 
-class TestAllPlugins(TestCaseInTempDir):
-
-    def test_plugin_appears_in_all_plugins(self):
-        # This test tests a new plugin appears in bzrlib.plugin.all_plugins().
-        # check the plugin is not loaded already
-        self.failIf(getattr(bzrlib.plugins, 'plugin', None))
-        # write a plugin that _cannot_ fail to load.
-        file('plugin.py', 'w').write("\n")
-        try:
-            bzrlib.plugin.load_from_path(['.'])
-            all_plugins = self.applyDeprecated(zero_ninetyone,
-                bzrlib.plugin.all_plugins)
-            self.failUnless('plugin' in all_plugins)
-            self.failUnless(getattr(bzrlib.plugins, 'plugin', None))
-            self.assertEqual(all_plugins['plugin'], bzrlib.plugins.plugin)
-        finally:
-            # remove the plugin 'plugin'
-            if 'bzrlib.plugins.plugin' in sys.modules:
-                del sys.modules['bzrlib.plugins.plugin']
-            if getattr(bzrlib.plugins, 'plugin', None):
-                del bzrlib.plugins.plugin
-        self.failIf(getattr(bzrlib.plugins, 'plugin', None))
-
-
 class TestPlugins(TestCaseInTempDir):
 
     def setup_plugin(self, source=""):
@@ -408,7 +384,8 @@
         try:
             # this is normally done by load_plugins -> set_plugins_path
             bzrlib.plugins.__path__ = [zip_name]
-            bzrlib.plugin.load_from_zip(zip_name)
+            self.applyDeprecated(one_three,
+                bzrlib.plugin.load_from_zip, zip_name)
             self.assertTrue(plugin_name in dir(bzrlib.plugins),
                             'Plugin is not loaded')
         finally:

=== modified file 'setup.py'
--- a/setup.py	2008-02-19 09:17:28 +0000
+++ b/setup.py	2008-02-20 10:36:15 +0000
@@ -265,6 +265,7 @@
     setup(**ARGS)
 
 elif 'py2exe' in sys.argv:
+    import glob
     # py2exe setup
     import py2exe
 
@@ -292,26 +293,56 @@
                                      comments = META_INFO['description'],
                                     )
 
-    additional_packages =  []
+    packages = BZRLIB['packages']
+    packages.remove('bzrlib')
+    packages = [i for i in packages if not i.startswith('bzrlib.plugins')]
+    includes = []
+    for i in glob.glob('bzrlib\\*.py'):
+        module = i[:-3].replace('\\', '.')
+        if module.endswith('__init__'):
+            module = module[:-len('__init__')]
+        includes.append(module)
+
+    additional_packages = set()
     if sys.version.startswith('2.4'):
         # adding elementtree package
-        additional_packages.append('elementtree')
+        additional_packages.add('elementtree')
     elif sys.version.startswith('2.5'):
-        additional_packages.append('xml.etree')
+        additional_packages.add('xml.etree')
     else:
         import warnings
         warnings.warn('Unknown Python version.\n'
                       'Please check setup.py script for compatibility.')
     # email package from std python library use lazy import,
     # so we need to explicitly add all package
-    additional_packages.append('email')
+    additional_packages.add('email')
 
     # text files for help topis
-    import glob
     text_topics = glob.glob('bzrlib/help_topics/en/*.txt')
-
-    options_list = {"py2exe": {"packages": BZRLIB['packages'] +
-                                           additional_packages,
+    topics_files = [('lib/help_topics/en', text_topics)]
+
+    # built-in plugins
+    plugins_files = []
+    for root, dirs, files in os.walk('bzrlib/plugins'):
+        x = []
+        for i in files:
+            if not i.endswith('.py'):
+                continue
+            if i == '__init__.py' and root == 'bzrlib/plugins':
+                continue
+            x.append(os.path.join(root, i))
+        if x:
+            target_dir = root[len('bzrlib/'):]  # install to 'plugins/...'
+            plugins_files.append((target_dir, x))
+    # find modules for built-in plugins
+    import tools.package_mf
+    mf = tools.package_mf.CustomModuleFinder()
+    mf.run_package('bzrlib/plugins')
+    packs, mods = mf.get_result()
+    additional_packages.update(packs)
+
+    options_list = {"py2exe": {"packages": packages + list(additional_packages),
+                               "includes": includes + mods,
                                "excludes": ["Tkinter", "medusa", "tools"],
                                "dist_dir": "win32_bzr.exe",
                               },
@@ -321,7 +352,7 @@
                    'tools/win32/bzr_postinstall.py',
                   ],
           zipfile='lib/library.zip',
-          data_files=[('lib/help_topics/en', text_topics)],
+          data_files=topics_files + plugins_files,
           )
 
 else:

=== modified file 'tools/win32/bzr.iss.cog'
--- a/tools/win32/bzr.iss.cog	2007-11-23 13:58:04 +0000
+++ b/tools/win32/bzr.iss.cog	2008-02-06 15:33:12 +0000
@@ -86,6 +86,7 @@
 Source: "*.*"; DestDir: "{app}"; Flags: ignoreversion;
 Source: "lib\*.*"; DestDir: "{app}\lib"; Flags: createallsubdirs ignoreversion recursesubdirs;
 Source: "doc\*.*"; DestDir: "{app}\doc"; Flags: createallsubdirs ignoreversion recursesubdirs;
+Source: "plugins\*.*"; DestDir: "{app}\plugins"; Components: plugins; Flags: createallsubdirs ignoreversion recursesubdirs;
 ; [[[cog
 ; try:
 ;     import pycurl
@@ -107,6 +108,7 @@
 
 [Components]
 Name: "main"; Description: "Main Files"; Types: full compact custom; Flags: fixed
+Name: "plugins"; Description: "Default plugins"; Types: full custom;
 ; [[[cog
 ; if ca_path:
 ;     cog.outl('Name: "cabundle"; '




More information about the bazaar-commits mailing list