1
# Copyright (C) 2005-2010 Canonical Ltd
1
# Copyright (C) 2006, 2007 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
135
136
'WorkingSetSize': mem_struct.WorkingSetSize,
136
137
'QuotaPeakPagedPoolUsage': mem_struct.QuotaPeakPagedPoolUsage,
137
138
'QuotaPagedPoolUsage': mem_struct.QuotaPagedPoolUsage,
138
'QuotaPeakNonPagedPoolUsage':
139
mem_struct.QuotaPeakNonPagedPoolUsage,
139
'QuotaPeakNonPagedPoolUsage': mem_struct.QuotaPeakNonPagedPoolUsage,
140
140
'QuotaNonPagedPoolUsage': mem_struct.QuotaNonPagedPoolUsage,
141
141
'PagefileUsage': mem_struct.PagefileUsage,
142
142
'PeakPagefileUsage': mem_struct.PeakPagefileUsage,
153
153
' or win32process')
156
# using base-2 units (see HACKING.txt).
157
trace.note('WorkingSize %7dKiB'
158
'\tPeakWorking %7dKiB\t%s',
156
trace.note('WorkingSize %7dKB'
157
'\tPeakWorking %7dKB\t%s',
159
158
info['WorkingSetSize'] / 1024,
160
159
info['PeakWorkingSetSize'] / 1024,
164
163
trace.note('%s', message)
165
trace.note('WorkingSize %8d KiB', info['WorkingSetSize'] / 1024)
166
trace.note('PeakWorking %8d KiB', info['PeakWorkingSetSize'] / 1024)
167
trace.note('PagefileUsage %8d KiB', info.get('PagefileUsage', 0) / 1024)
168
trace.note('PeakPagefileUsage %8d KiB',
169
info.get('PeakPagefileUsage', 0) / 1024)
170
trace.note('PrivateUsage %8d KiB', info.get('PrivateUsage', 0) / 1024)
164
trace.note('WorkingSize %8d KB', info['WorkingSetSize'] / 1024)
165
trace.note('PeakWorking %8d KB', info['PeakWorkingSetSize'] / 1024)
166
trace.note('PagefileUsage %8d KB', info.get('PagefileUsage', 0) / 1024)
167
trace.note('PeakPagefileUsage %8d KB', info.get('PeakPagefileUsage', 0) / 1024)
168
trace.note('PrivateUsage %8d KB', info.get('PrivateUsage', 0) / 1024)
171
169
trace.note('PageFaultCount %8d', info.get('PageFaultCount', 0))
192
190
(bufx, bufy, curx, cury, wattr,
193
left, top, right, bottom, maxx, maxy) = struct.unpack(
194
"hhhhHhhhhhh", csbi.raw)
191
left, top, right, bottom, maxx, maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw)
195
192
sizex = right - left + 1
196
193
sizey = bottom - top + 1
197
194
return (sizex, sizey)
416
413
def _ensure_with_dir(path):
417
if (not os.path.split(path)[0] or path.startswith(u'*')
418
or path.startswith(u'?')):
414
if not os.path.split(path)[0] or path.startswith(u'*') or path.startswith(u'?'):
419
415
return u'./' + path, True
421
417
return path, False
522
518
trace.mutter('Unable to set hidden attribute on %r: %s', path, e)
525
def _command_line_to_argv(command_line, single_quotes_allowed=False):
521
def command_line_to_argv(command_line, wildcard_expansion=True,
522
single_quotes_allowed=False):
526
523
"""Convert a Unicode command line into a list of argv arguments.
528
It performs wildcard expansion to make wildcards act closer to how they
529
work in posix shells, versus how they work by default on Windows. Quoted
530
arguments are left untouched.
525
This optionally does wildcard expansion, etc. It is intended to make
526
wildcards act closer to how they work in posix shells, versus how they
527
work by default on Windows. Quoted arguments are left untouched.
532
529
:param command_line: The unicode string to split into an arg list.
530
:param wildcard_expansion: Whether wildcard expansion should be applied to
531
each argument. True by default.
533
532
:param single_quotes_allowed: Whether single quotes are accepted as quoting
534
533
characters like double quotes. False by
557
556
if command_line is None:
558
557
raise ctypes.WinError()
559
558
# Skip the first argument, since we only care about parameters
560
argv = _command_line_to_argv(command_line)[1:]
559
argv = command_line_to_argv(command_line)[1:]
561
560
if getattr(sys, 'frozen', None) is None:
562
561
# Invoked via 'python.exe' which takes the form:
563
562
# python.exe [PYTHON_OPTIONS] C:\Path\bzr [BZR_OPTIONS]