Changeset 781:d4455b2cd469 for src


Ignore:
Timestamp:
05/22/16 06:42:44 (9 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

The files already removable are removed in advance (re #298)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/update.py

    r681 r781  
    297297#------------------------------------------------------------------------------
    298298
     299def removeFiles(directory, listener, removed, count):
     300    """Remove the given files."""
     301    toremoveDir = None
     302   
     303    listener.startRemoving()
     304
     305    removed.sort(reverse = True)
     306    for path in removed:
     307        removePath = createLocalPath(directory, path)
     308        removeFile(toremoveDir, directory, removePath)
     309
     310        removeDirectory = os.path.dirname(removePath)
     311        try:
     312            os.removedirs(removeDirectory)
     313        except:
     314            pass
     315
     316        count += 1
     317        listener.removed(path, count)
     318
     319    return count
     320
     321#------------------------------------------------------------------------------
     322
    299323def updateFiles(directory, updateURL, listener,
    300324                manifest, modifiedAndNew, removed, localRemoved):
     
    314338        updateURL += "/" + os.name
    315339
     340        removeCount = 0
     341        if localRemoved:
     342            removeCount = removeFiles(directory, listener,
     343                                      localRemoved, removeCount)
     344       
    316345        for (path, size, sum) in modifiedAndNew:
    317346            targetFile = createLocalPath(directory, path)
     
    346375            count += 1
    347376            listener.renamed(path, count)
    348        
    349         listener.startRemoving()
    350         count = 0
    351         removed += localRemoved
    352         removed.sort(reverse = True)
    353         for path in removed:           
    354             removePath = createLocalPath(directory, path)
    355             removeFile(toremoveDir, directory, removePath)
    356 
    357             removeDirectory = os.path.dirname(removePath)
    358             try:
    359                 os.removedirs(removeDirectory)
    360             except:
    361                 pass
    362 
    363             count += 1
    364             listener.removed(path, count)
     377
     378        removeFiles(directory, listener, removed, removeCount)
    365379
    366380        listener.writingManifest()
Note: See TracChangeset for help on using the changeset viewer.