mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
triple double quotes to triple single quotes
This commit is contained in:
parent
77cd930bba
commit
bc42a4bb11
1 changed files with 16 additions and 16 deletions
|
@ -1,11 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
'''
|
||||
Manage the Windows System PATH
|
||||
|
||||
Note that not all Windows applications will rehash the PATH environment variable,
|
||||
Only the ones that listen to the WM_SETTINGCHANGE message
|
||||
http://support.microsoft.com/kb/104011
|
||||
"""
|
||||
'''
|
||||
|
||||
# Python Libs
|
||||
import logging
|
||||
|
@ -27,23 +27,23 @@ log = logging.getLogger(__name__)
|
|||
|
||||
|
||||
def __virtual__():
|
||||
"""
|
||||
'''
|
||||
Load only on Windows
|
||||
"""
|
||||
'''
|
||||
if salt.utils.is_windows() and HAS_WIN32:
|
||||
return 'win_path'
|
||||
return False
|
||||
|
||||
|
||||
def _normalize_dir(string):
|
||||
"""
|
||||
'''
|
||||
Normalize the directory to make comparison possible
|
||||
"""
|
||||
'''
|
||||
return re.sub(r'\\$', '', string.lower())
|
||||
|
||||
|
||||
def rehash():
|
||||
"""
|
||||
'''
|
||||
Send a WM_SETTINGCHANGE Broadcast to Windows to refresh the Environment variables
|
||||
|
||||
CLI Example:
|
||||
|
@ -51,7 +51,7 @@ def rehash():
|
|||
... code-block:: bash
|
||||
|
||||
salt '*' win_path.rehash
|
||||
"""
|
||||
'''
|
||||
return win32gui.SendMessageTimeout(win32con.HWND_BROADCAST,
|
||||
win32con.WM_SETTINGCHANGE,
|
||||
0,
|
||||
|
@ -61,7 +61,7 @@ def rehash():
|
|||
|
||||
|
||||
def get_path():
|
||||
"""
|
||||
'''
|
||||
Returns a list of items in the SYSTEM path
|
||||
|
||||
CLI Example:
|
||||
|
@ -69,7 +69,7 @@ def get_path():
|
|||
.. code-block:: bash
|
||||
|
||||
salt '*' win_path.get_path
|
||||
"""
|
||||
'''
|
||||
ret = __salt__['reg.read_key']('HKEY_LOCAL_MACHINE',
|
||||
'SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment',
|
||||
'PATH').split(';')
|
||||
|
@ -79,7 +79,7 @@ def get_path():
|
|||
|
||||
|
||||
def exists(path):
|
||||
"""
|
||||
'''
|
||||
Check if the directory is configured in the SYSTEM path
|
||||
Case-insensitive and ignores trailing backslash
|
||||
|
||||
|
@ -93,7 +93,7 @@ def exists(path):
|
|||
salt '*' win_path.exists 'c:\\python27'
|
||||
salt '*' win_path.exists 'c:\\python27\\'
|
||||
salt '*' win_path.exists 'C:\\pyThon27'
|
||||
"""
|
||||
'''
|
||||
path = _normalize_dir(path)
|
||||
sysPath = get_path()
|
||||
|
||||
|
@ -101,7 +101,7 @@ def exists(path):
|
|||
|
||||
|
||||
def add(path, index=0):
|
||||
"""
|
||||
'''
|
||||
Add the directory to the SYSTEM path in the index location
|
||||
|
||||
Returns:
|
||||
|
@ -116,7 +116,7 @@ def add(path, index=0):
|
|||
|
||||
# Will add to the end of the path
|
||||
salt '*' win_path.add 'c:\\python27' index='-1'
|
||||
"""
|
||||
'''
|
||||
currIndex = -1
|
||||
sysPath = get_path()
|
||||
path = _normalize_dir(path)
|
||||
|
@ -156,7 +156,7 @@ def add(path, index=0):
|
|||
|
||||
|
||||
def remove(path):
|
||||
"""
|
||||
'''
|
||||
Remove the directory from the SYSTEM path
|
||||
|
||||
Returns:
|
||||
|
@ -168,7 +168,7 @@ def remove(path):
|
|||
|
||||
# Will remove C:\Python27 from the path
|
||||
salt '*' win_path.remove 'c:\\python27'
|
||||
"""
|
||||
'''
|
||||
path = _normalize_dir(path)
|
||||
sysPath = get_path()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue