[Pkg-bazaar-commits] ./bzr-builddeb/trunk r243: Import apt_pkg only when used, as it is used rarely and importing it

James Westby jw+debian at jameswestby.net
Mon Jul 7 10:07:42 UTC 2008


------------------------------------------------------------
revno: 243
committer: James Westby <jw+debian at jameswestby.net>
branch nick: trunk
timestamp: Mon 2008-07-07 11:07:42 +0100
message:
  Import apt_pkg only when used, as it is used rarely and importing it
  has an overhead, and also leads to increased memory usage.
modified:
  builder.py
  debian/changelog
    ------------------------------------------------------------
    revno: 241.1.3
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Tue 2008-06-24 13:04:53 +0200
    message:
      Import apt_pkg only when it's needed. Saves the allocation of about 1.3Mb worth of 
      data every time bzr is run.
    modified:
      builder.py
-------------- next part --------------
=== modified file 'builder.py'
--- a/builder.py	2008-05-15 15:59:32 +0000
+++ b/builder.py	2008-06-24 11:04:53 +0000
@@ -25,8 +25,6 @@
 import tempfile
 import os
 
-import apt_pkg
-
 from debian_bundle.changelog import Version
 
 from bzrlib.branch import Branch
@@ -210,6 +208,7 @@
     os.unlink(fetched_tarball)
 
   def _get_upstream_from_archive(self):
+    import apt_pkg
     apt_pkg.init()
     sources = apt_pkg.GetPkgSrcRecords()
     sources.Restart()

=== modified file 'debian/changelog'
--- a/debian/changelog	2008-07-07 10:06:23 +0000
+++ b/debian/changelog	2008-07-07 10:07:42 +0000
@@ -4,6 +4,8 @@
   * Support +bzr for snapshots as well as ~bzr.
   * Lock the tree before starting as remote trees are more strict about this,
     meaning there were problems with remote branches.
+  * Import apt_pkg only when used, as it is used rarely and importing it
+    has an overhead, and also leads to increased memory usage.
 
  -- James Westby <james.westby at canonical.com>  Fri, 13 Jun 2008 15:03:53 +0100
 



More information about the Pkg-bazaar-commits mailing list