refactor plan...
This commit is contained in:
@@ -62,3 +62,11 @@ out exact error is try to parse error string (which is localized).
|
|||||||
==> database
|
==> database
|
||||||
* brr...
|
* brr...
|
||||||
|
|
||||||
|
|
||||||
|
==> class attributes
|
||||||
|
* In some classes there are some attributes assigned but never
|
||||||
|
used. (see remove_unused_attributes.patch)
|
||||||
|
|
||||||
|
* PiSi uses heavy classes and creates thousands of instances of them
|
||||||
|
(Package, Metadata, Dependency, ...). These classes should define
|
||||||
|
__slots__ to reduce the heap used.
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
Index: pisi/atomicoperations.py
|
||||||
|
===================================================================
|
||||||
|
--- pisi/atomicoperations.py (revision 11473)
|
||||||
|
+++ pisi/atomicoperations.py (working copy)
|
||||||
|
@@ -42,12 +42,8 @@
|
||||||
|
|
||||||
|
class AtomicOperation(object):
|
||||||
|
|
||||||
|
- def __init__(self, ignore_dep = None):
|
||||||
|
- #self.package = package
|
||||||
|
- if ignore_dep==None:
|
||||||
|
- self.ignore_dep = ctx.config.get_option('ignore_dependency')
|
||||||
|
- else:
|
||||||
|
- self.ignore_dep = ignore_dep
|
||||||
|
+ def __init__(self):
|
||||||
|
+ pass
|
||||||
|
|
||||||
|
def run(self, package):
|
||||||
|
"perform an atomic package operation"
|
||||||
|
@@ -58,7 +54,7 @@
|
||||||
|
"Install class, provides install routines for pisi packages"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
- def from_name(name, ignore_dep = None):
|
||||||
|
+ def from_name(name):
|
||||||
|
# download package and return an installer object
|
||||||
|
# find package in repository
|
||||||
|
repo = ctx.packagedb.which_repo(name)
|
||||||
|
@@ -77,13 +73,13 @@
|
||||||
|
|
||||||
|
ctx.ui.info(_("Package URI: %s") % pkg_path, verbose=True)
|
||||||
|
|
||||||
|
- return Install(pkg_path, ignore_dep)
|
||||||
|
+ return Install(pkg_path)
|
||||||
|
else:
|
||||||
|
raise Error(_("Package %s not found in any active repository.") % name)
|
||||||
|
|
||||||
|
- def __init__(self, package_fname, ignore_dep = None, ignore_file_conflicts = None):
|
||||||
|
+ def __init__(self, package_fname, ignore_file_conflicts = None):
|
||||||
|
"initialize from a file name"
|
||||||
|
- super(Install, self).__init__(ignore_dep)
|
||||||
|
+ super(Install, self).__init__()
|
||||||
|
if not ignore_file_conflicts:
|
||||||
|
ignore_file_conflicts = ctx.get_option('ignore_file_conflicts')
|
||||||
|
self.ignore_file_conflicts = ignore_file_conflicts
|
||||||
|
@@ -394,8 +390,8 @@
|
||||||
|
|
||||||
|
class Remove(AtomicOperation):
|
||||||
|
|
||||||
|
- def __init__(self, package_name, ignore_dep = None):
|
||||||
|
- super(Remove, self).__init__(ignore_dep)
|
||||||
|
+ def __init__(self, package_name):
|
||||||
|
+ super(Remove, self).__init__()
|
||||||
|
self.package_name = package_name
|
||||||
|
self.package = ctx.packagedb.get_package(self.package_name, pisi.itembyrepodb.installed)
|
||||||
|
try:
|
||||||
|
Index: pisi/archive.py
|
||||||
|
===================================================================
|
||||||
|
--- pisi/archive.py (revision 11473)
|
||||||
|
+++ pisi/archive.py (working copy)
|
||||||
|
@@ -42,12 +42,11 @@
|
||||||
|
self.type = atype
|
||||||
|
|
||||||
|
def unpack(self, target_dir, clean_dir = False):
|
||||||
|
- self.target_dir = target_dir
|
||||||
|
# first we check if we need to clean-up our working env.
|
||||||
|
- if os.path.exists(self.target_dir) and clean_dir:
|
||||||
|
- util.clean_dir(self.target_dir)
|
||||||
|
+ if os.path.exists(target_dir) and clean_dir:
|
||||||
|
+ util.clean_dir(target_dir)
|
||||||
|
|
||||||
|
- os.makedirs(self.target_dir)
|
||||||
|
+ os.makedirs(target_dir)
|
||||||
|
|
||||||
|
|
||||||
|
class ArchiveBinary(ArchiveBase):
|
||||||
Reference in New Issue
Block a user