~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/win32utils.py

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Win32-specific helper functions
18
18
 
144
144
        trace.note('Cannot debug memory on win32 without ctypes'
145
145
                   ' or win32process')
146
146
        return
147
 
    trace.note('WorkingSize       %8d kB', info['WorkingSetSize'] / 1024)
148
 
    trace.note('PeakWorking       %8d kB', info['PeakWorkingSetSize'] / 1024)
149
147
    if short:
 
148
        trace.note('WorkingSize %7dKB'
 
149
                   '\tPeakWorking %7dKB\t%s',
 
150
                   info['WorkingSetSize'] / 1024,
 
151
                   info['PeakWorkingSetSize'] / 1024,
 
152
                   message)
150
153
        return
151
 
    trace.note('PagefileUsage     %8d kB', info.get('PagefileUsage', 0) / 1024)
152
 
    trace.note('PeakPagefileUsage %8d kB', info.get('PeakPagefileUsage', 0) / 1024)
153
 
    trace.note('PrivateUsage      %8d kB', info.get('PrivateUsage', 0) / 1024)
 
154
    if message:
 
155
        trace.note('%s', message)
 
156
    trace.note('WorkingSize       %8d KB', info['WorkingSetSize'] / 1024)
 
157
    trace.note('PeakWorking       %8d KB', info['PeakWorkingSetSize'] / 1024)
 
158
    trace.note('PagefileUsage     %8d KB', info.get('PagefileUsage', 0) / 1024)
 
159
    trace.note('PeakPagefileUsage %8d KB', info.get('PeakPagefileUsage', 0) / 1024)
 
160
    trace.note('PrivateUsage      %8d KB', info.get('PrivateUsage', 0) / 1024)
154
161
    trace.note('PageFaultCount    %8d', info.get('PageFaultCount', 0))
155
162
 
156
163
 
183
190
 
184
191
def _get_sh_special_folder_path(csidl):
185
192
    """Call SHGetSpecialFolderPathW if available, or return None.
186
 
    
 
193
 
187
194
    Result is always unicode (or None).
188
195
    """
189
196
    if has_ctypes:
401
408
        return u'./' + path, True
402
409
    else:
403
410
        return path, False
404
 
    
 
411
 
405
412
def _undo_ensure_with_dir(path, corrected):
406
413
    if corrected:
407
414
        return path[2:]
426
433
    import glob
427
434
    expanded_file_list = []
428
435
    for possible_glob in file_list:
429
 
        
 
436
 
430
437
        # work around bugs in glob.glob()
431
438
        # - Python bug #1001604 ("glob doesn't return unicode with ...")
432
439
        # - failing expansion for */* with non-iso-8859-* chars
441
448
        else:
442
449
            glob_files = [_undo_ensure_with_dir(elem, corrected) for elem in glob_files]
443
450
            expanded_file_list += glob_files
444
 
            
445
 
    return [elem.replace(u'\\', u'/') for elem in expanded_file_list] 
 
451
 
 
452
    return [elem.replace(u'\\', u'/') for elem in expanded_file_list]
446
453
 
447
454
 
448
455
def get_app_path(appname):