* pisi-1.1 maintanence branch.
This commit is contained in:
@@ -1,72 +0,0 @@
|
||||
|
||||
Here we take notes of the strange stuff, so we can refactor them after
|
||||
Pardus 2007 release.
|
||||
|
||||
|
||||
==> Locale support
|
||||
* bindtextdomain and textdomain calls are not necessary, because
|
||||
gettext.translation() dont use them.
|
||||
|
||||
* setlocale call is probably necessary for some stuff, but not for
|
||||
message translation, it seems gettext.translation() api looks for
|
||||
environment LC_ALL, LC_MESSAGES anyway.
|
||||
|
||||
* pygettext.py shouldn't be needed at all. Plain xgettext works with
|
||||
python source.
|
||||
|
||||
|
||||
==> Utility functions
|
||||
* sha1_file is suboptimal for binary files and sha1_data has some
|
||||
exception confusion. These two functions should be a lot simpler.
|
||||
|
||||
* get_file_hashes is overly complex and contains strange code like:
|
||||
for r, d, f in os.walk(parent, topdown=False): pass
|
||||
|
||||
* dir_size tries to calculate symlink lengths, this is probably not very
|
||||
helpful, since in most cases, they fit in the inode, and wont take any
|
||||
extra space at all. We can keep the number of file in the index though.
|
||||
That way we can calculate package size + (nr of files * inode size of fs)
|
||||
to give a more correct required disk size.
|
||||
|
||||
* what the heck is unzip there? it is not even used at all and defined like:
|
||||
def unzip(seq):
|
||||
return zip(*seq)
|
||||
|
||||
|
||||
==> code readability
|
||||
* Public functions should contain doc strings.
|
||||
|
||||
* Python builtins like file, list, etc should be avoided in variable names.
|
||||
There is even a file.py module!
|
||||
|
||||
* a,b,c,d,f,r,_i are equally bad.
|
||||
|
||||
* some import'ed modules are not used inside the importer modules, cleanup needed.
|
||||
|
||||
* Would be very good if we can avoid "from x import y" form, it makes it
|
||||
harder to reload modules.
|
||||
|
||||
|
||||
==> exceptions
|
||||
* Current model is bad. Exception names should tell what is the error type. Instead
|
||||
we have one Error exception in every module. If I call pisi.api.install("lala"),
|
||||
I should get pisi.api.PackageNotFound or pisi.install.PackageNotFound or something
|
||||
like that. For every kind of error, you get pisi.api.Error now, and only way to find
|
||||
out exact error is try to parse error string (which is localized).
|
||||
|
||||
* class Exception(Exception) is evil.
|
||||
|
||||
* There shouldn't be a bare Except: clause in pisi modules.
|
||||
|
||||
|
||||
==> database
|
||||
* 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.
|
||||
@@ -1,76 +0,0 @@
|
||||
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