Mercurial > public > mercurial-scm > hg
comparison contrib/automation/hgautomation/windows.py @ 42064:0e9066db5e44
automation: use raw strings when there are backslashes
Otherwise Python 3.8 complains.
Differential Revision: https://phab.mercurial-scm.org/D6201
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 04 Apr 2019 18:01:02 -0700 |
parents | b05a3e28cf24 |
children | 4274b1369b75 |
comparison
equal
deleted
inserted
replaced
42063:912d82daeda3 | 42064:0e9066db5e44 |
---|---|
112 | 112 |
113 def fix_authorized_keys_permissions(winrm_client, path): | 113 def fix_authorized_keys_permissions(winrm_client, path): |
114 commands = [ | 114 commands = [ |
115 '$ErrorActionPreference = "Stop"', | 115 '$ErrorActionPreference = "Stop"', |
116 'Repair-AuthorizedKeyPermission -FilePath %s -Confirm:$false' % path, | 116 'Repair-AuthorizedKeyPermission -FilePath %s -Confirm:$false' % path, |
117 'icacls %s /remove:g "NT Service\sshd"' % path, | 117 r'icacls %s /remove:g "NT Service\sshd"' % path, |
118 ] | 118 ] |
119 | 119 |
120 run_powershell(winrm_client, '\n'.join(commands)) | 120 run_powershell(winrm_client, '\n'.join(commands)) |
121 | 121 |
122 | 122 |
190 | 190 |
191 def find_latest_dist(winrm_client, pattern): | 191 def find_latest_dist(winrm_client, pattern): |
192 """Find path to newest file in dist/ directory matching a pattern.""" | 192 """Find path to newest file in dist/ directory matching a pattern.""" |
193 | 193 |
194 res = winrm_client.execute_ps( | 194 res = winrm_client.execute_ps( |
195 '$v = Get-ChildItem -Path C:\hgdev\src\dist -Filter "%s" ' | 195 r'$v = Get-ChildItem -Path C:\hgdev\src\dist -Filter "%s" ' |
196 '| Sort-Object LastWriteTime -Descending ' | 196 '| Sort-Object LastWriteTime -Descending ' |
197 '| Select-Object -First 1\n' | 197 '| Select-Object -First 1\n' |
198 '$v.name' % pattern | 198 '$v.name' % pattern |
199 ) | 199 ) |
200 return res[0] | 200 return res[0] |
268 ``python_version`` is a ``X.Y`` string like ``2.7`` or ``3.7``. | 268 ``python_version`` is a ``X.Y`` string like ``2.7`` or ``3.7``. |
269 ``arch`` is ``x86`` or ``x64``. | 269 ``arch`` is ``x86`` or ``x64``. |
270 ``test_flags`` is a str representing extra arguments to pass to | 270 ``test_flags`` is a str representing extra arguments to pass to |
271 ``run-tests.py``. | 271 ``run-tests.py``. |
272 """ | 272 """ |
273 if not re.match('\d\.\d', python_version): | 273 if not re.match(r'\d\.\d', python_version): |
274 raise ValueError('python_version must be \d.\d; got %s' % | 274 raise ValueError(r'python_version must be \d.\d; got %s' % |
275 python_version) | 275 python_version) |
276 | 276 |
277 if arch not in ('x86', 'x64'): | 277 if arch not in ('x86', 'x64'): |
278 raise ValueError('arch must be x86 or x64; got %s' % arch) | 278 raise ValueError('arch must be x86 or x64; got %s' % arch) |
279 | 279 |