diff --git a/RefactorPlan b/RefactorPlan new file mode 100644 index 00000000..1300f81c --- /dev/null +++ b/RefactorPlan @@ -0,0 +1,64 @@ + +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... +