Add additional required dll's

This commit is contained in:
twangboy 2016-09-06 17:36:38 -06:00
parent fa09050150
commit b4479bff5f

View file

@ -303,6 +303,11 @@ if WITH_SETUPTOOLS:
self.run_command('install-pycrypto-windows')
self.distribution.salt_installing_pycrypto_windows = None
# Install PyYAML
self.distribution.salt_installing_pyyaml_windows = True
self.run_command('install-pyyaml-windows')
self.distribution.salt_installing_pyyaml_windows = None
# Download the required DLLs
self.distribution.salt_download_windows_dlls = True
self.run_command('download-windows-dlls')
@ -376,6 +381,37 @@ class InstallPyCryptoWindowsWheel(Command):
call_subprocess(call_arguments)
class InstallCompiledPyYaml(Command):
description = 'Install PyYAML on Windows'
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
if getattr(self.distribution, 'salt_installing_pyyaml_windows', None) is None:
print('This command is not meant to be called on it\'s own')
exit(1)
import platform
from pip.utils import call_subprocess
from pip.utils.logging import indent_log
platform_bits, _ = platform.architecture()
call_arguments = ['easy_install', '-Z']
if platform_bits == '64bit':
call_arguments.append(
'http://repo.saltstack.com/windows/dependencies/64/PyYAML-3.11.win-amd64-py2.7.exe'
)
else:
call_arguments.append(
'http://repo.saltstack.com/windows/dependencies/32/PyYAML-3.11.win-amd64-py2.7.exe'
)
with indent_log():
call_subprocess(call_arguments)
class DownloadWindowsDlls(Command):
description = 'Download required DLL\'s for windows'
@ -393,14 +429,14 @@ class DownloadWindowsDlls(Command):
import platform
from pip.utils.logging import indent_log
platform_bits, _ = platform.architecture()
url = 'https://repo.saltstack.com/windows/dependencies/{bits}/{fname}32.dll'
dest = os.path.join(os.path.dirname(sys.executable), '{fname}32.dll')
url = 'https://repo.saltstack.com/windows/dependencies/{bits}/{fname}.dll'
dest = os.path.join(os.path.dirname(sys.executable), '{fname}.dll')
with indent_log():
for fname in ('libeay', 'ssleay'):
for fname in ('libeay32', 'ssleay32', 'libsodium', 'msvcr120'):
furl = url.format(bits=platform_bits[:2], fname=fname)
fdest = dest.format(fname=fname)
if not os.path.exists(fdest):
log.info('Downloading {0}32.dll to {1} from {2}'.format(fname, fdest, furl))
log.info('Downloading {0}.dll to {1} from {2}'.format(fname, fdest, furl))
try:
import requests
from contextlib import closing
@ -413,7 +449,7 @@ class DownloadWindowsDlls(Command):
wfh.flush()
else:
log.error(
'Failed to download {0}32.dll to {1} from {2}'.format(
'Failed to download {0}.dll to {1} from {2}'.format(
fname, fdest, furl
)
)
@ -430,7 +466,7 @@ class DownloadWindowsDlls(Command):
wfh.flush()
else:
log.error(
'Failed to download {0}32.dll to {1} from {2}'.format(
'Failed to download {0}.dll to {1} from {2}'.format(
fname, fdest, furl
)
)
@ -752,6 +788,10 @@ class Install(install):
self.distribution.salt_installing_pycrypto_windows = True
self.run_command('install-pycrypto-windows')
self.distribution.salt_installing_pycrypto_windows = None
# Install PyYAML
self.distribution.salt_installing_pyyaml_windows = True
self.run_command('install-pyyaml-windows')
self.distribution.salt_installing_pyyaml_windows = None
# Download the required DLLs
self.distribution.salt_download_windows_dlls = True
self.run_command('download-windows-dlls')
@ -883,6 +923,7 @@ class SaltDistribution(distutils.dist.Distribution):
'install_lib': InstallLib})
if IS_WINDOWS_PLATFORM:
self.cmdclass.update({'install-pycrypto-windows': InstallPyCryptoWindowsWheel,
'install-pyyaml-windows': InstallCompiledPyYaml,
'download-windows-dlls': DownloadWindowsDlls})
if __saltstack_version__.info < (2015, 8): # pylint: disable=undefined-variable
self.cmdclass.update({'install-m2crypto-windows': InstallM2CryptoWindows})