mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Move pytz to 3rd party import, add to __virtual__
Add pytz to freezer includes
This commit is contained in:
parent
b8a6488688
commit
72cc361c7b
2 changed files with 10 additions and 1 deletions
|
@ -6,12 +6,18 @@ from __future__ import absolute_import, unicode_literals, print_function
|
||||||
|
|
||||||
# Import Python libs
|
# Import Python libs
|
||||||
import logging
|
import logging
|
||||||
import pytz
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
# Import Salt libs
|
# Import Salt libs
|
||||||
from salt.exceptions import CommandExecutionError
|
from salt.exceptions import CommandExecutionError
|
||||||
|
|
||||||
|
# Import 3rd party libs
|
||||||
|
try:
|
||||||
|
import pytz
|
||||||
|
HAS_PYTZ = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PYTZ = False
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Define the module's virtual name
|
# Define the module's virtual name
|
||||||
|
@ -185,6 +191,8 @@ def __virtual__():
|
||||||
'''
|
'''
|
||||||
if not __utils__['platform.is_windows']():
|
if not __utils__['platform.is_windows']():
|
||||||
return False, "Module win_timezone: Not on Windows client"
|
return False, "Module win_timezone: Not on Windows client"
|
||||||
|
if not HAS_PYTZ:
|
||||||
|
return False, "Module win_timezone: pytz not found"
|
||||||
if not __utils__['path.which']('tzutil'):
|
if not __utils__['path.which']('tzutil'):
|
||||||
return False, "Module win_timezone: tzutil not found"
|
return False, "Module win_timezone: tzutil not found"
|
||||||
return __virtualname__
|
return __virtualname__
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -1121,6 +1121,7 @@ class SaltDistribution(distutils.dist.Distribution):
|
||||||
'wmi',
|
'wmi',
|
||||||
'site',
|
'site',
|
||||||
'psutil',
|
'psutil',
|
||||||
|
'pytz',
|
||||||
])
|
])
|
||||||
elif IS_SMARTOS_PLATFORM:
|
elif IS_SMARTOS_PLATFORM:
|
||||||
# we have them as requirements in pkg/smartos/esky/requirements.txt
|
# we have them as requirements in pkg/smartos/esky/requirements.txt
|
||||||
|
|
Loading…
Add table
Reference in a new issue