Windows now has a static requirements file and no longer needs hacks

This commit is contained in:
Pedro Algarvio 2019-03-20 14:02:51 +00:00
parent a86af2b088
commit b039cec21a
No known key found for this signature in database
GPG Key ID: BB36BF6584A298FF
4 changed files with 132 additions and 108 deletions

View File

@ -56,7 +56,11 @@ def _install_requirements(session, *extra_requirements):
# Install requirements
distro_requirements = None
if not IS_WINDOWS:
if IS_WINDOWS:
_distro_requirements = os.path.join(REPO_ROOT, 'requirements', 'static', 'windows.txt')
if os.path.exists(_distro_requirements):
distro_requirements = _distro_requirements
else:
# The distro package doesn't output anything for Windows
session.install('distro')
output = session.run('distro', '-j', silent=True)
@ -120,11 +124,6 @@ def _install_requirements(session, *extra_requirements):
if extra_requirements:
session.install(*extra_requirements)
if IS_WINDOWS:
# Windows hacks :/
nox_windows_setup = os.path.join(REPO_ROOT, 'tests', 'support', 'nox-windows-setup.py')
session.run('python', nox_windows_setup)
def _run_with_coverage(session, *test_cmd):
session.install('coverage==4.5.3')

View File

@ -0,0 +1,37 @@
apache-libcloud==1.0.0
boto3
boto>=2.46.0
dmidecode
dnspython
docker==2.7.0
ioflo
jsonschema<=2.6.0
keyring==5.7.1
kubernetes<4.0
mock<1.1.0
more-itertools==5.0.0
msgpack-python >= 0.4.2, != 0.5.5
patch
psutil
pycryptodomex
pyopenssl
python-etcd==0.4.2
python-gnupg
pyvmomi
rfc3987
salttesting==2017.6.1
sed
setproctitle
strict_rfc3339
supervisor; python_version < '3'
timelib
tornado<5.0
virtualenv
# If running under windows, please uncomment the following 2 requirements before running
# pip-compile -o requirements/static/windows.txt requirements/zeromq.txt requirements/raet.txt requirements/pytest.txt requirements/static/windows.in
#
# On non windows, please copy the following 2 requirements to the generated windows.txt, un-commented
#pywin32==223
#wmi==1.4.9

View File

@ -0,0 +1,90 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile -o requirements/static/windows.txt requirements/zeromq.txt requirements/raet.txt requirements/pytest.txt requirements/static/windows.in
#
apache-libcloud==1.0.0
asn1crypto==0.24.0 # via cryptography
atomicwrites==1.3.0 # via pytest
attrs==19.1.0 # via pytest
backports-abc==0.5 # via tornado
backports.ssl-match-hostname==3.7.0.1 # via docker, websocket-client
boto3==1.9.117
boto==2.49.0
botocore==1.12.117 # via boto3, s3transfer
cachetools==3.1.0 # via google-auth
certifi==2019.3.9 # via kubernetes, requests, tornado
cffi==1.12.2 # via cryptography
chardet==3.0.4 # via requests
coverage==4.5.3 # via pytest-cov
cryptography==2.6.1 # via pyopenssl
dmidecode==0.9.0
dnspython==1.16.0
docker-pycreds==0.4.0 # via docker
docker==2.7.0
docutils==0.14 # via botocore
enum34==1.1.6 # via cryptography, raet
funcsigs==1.0.2 # via pytest
functools32==3.2.3.post2 # via jsonschema
futures==3.2.0 ; python_version < "3.0"
google-auth==1.6.3 # via kubernetes
idna==2.8 # via requests
ioflo==1.7.5
ipaddress==1.0.22 # via cryptography, docker, kubernetes
jinja2==2.10
jmespath==0.9.4 # via boto3, botocore
jsonschema==2.6.0
keyring==5.7.1
kubernetes==3.0.0
libnacl==1.6.1
markupsafe==1.1.1
meld3==1.0.2 # via supervisor
mock==1.0.1
more-itertools==5.0.0
msgpack-python==0.5.6
msgpack==0.6.1
patch==1.16
pathlib2==2.3.3 # via pytest
pluggy==0.9.0 # via pytest
psutil==5.6.1
py==1.8.0 # via pytest
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via pyasn1-modules, rsa
pycparser==2.19 # via cffi
pycrypto==2.6.1
pycryptodomex==3.7.3
pyopenssl==19.0.0
pytest-cov==2.6.1
pytest-helpers-namespace==2019.1.8
pytest-salt-runtests-bridge==2019.1.30
pytest-salt==2018.12.8
pytest-tempdir==2018.8.11
pytest-timeout==1.3.3
pytest==4.3.1
python-dateutil==2.8.0 # via botocore, kubernetes
python-etcd==0.4.2
python-gnupg==0.4.4
pyvmomi==6.7.1.2018.12
pyyaml==3.13
pyzmq==18.0.1 ; python_version != "3.4"
raet==0.6.8
requests==2.21.0
rfc3987==1.3.8
rsa==4.0 # via google-auth
s3transfer==0.2.0 # via boto3
salttesting==2017.6.1
scandir==1.10.0 # via pathlib2
sed==0.3.1
setproctitle==1.1.10
singledispatch==3.4.0.3 # via tornado
six==1.12.0 # via cryptography, docker, docker-pycreds, google-auth, kubernetes, more-itertools, pathlib2, pyopenssl, pytest, python-dateutil, pyvmomi, raet, salttesting, singledispatch, websocket-client
strict-rfc3339==0.7
supervisor==3.3.5 ; python_version < "3"
timelib==0.2.4
tornado==4.5.3 ; python_version < "3"
urllib3==1.24.1 # via botocore, kubernetes, python-etcd, requests
virtualenv==16.4.3
websocket-client==0.40.0 # via docker, kubernetes
pywin32==223
wmi==1.4.9

View File

@ -1,102 +0,0 @@
# -*- coding: utf-8 -*-
'''
tests.support.nox-windows-setup
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This script is meant to run under the nox virtualenv to take care of required
windows procedures
'''
# pylint: disable=resource-leakage
from __future__ import absolute_import, print_function, unicode_literals
import os
import re
import sys
import site
import shutil
try:
import site
SITE_PACKAGES = site.getsitepackages()
PYTHON_EXECUTABLE_DIRECTORY = os.path.dirname(sys.executable)
PYTHON_SCRIPTS_DIR = os.path.join(PYTHON_EXECUTABLE_DIRECTORY, 'Scripts')
except AttributeError:
# The site module does not have the getsitepackages function when running within a virtualenv
# But the site-packages directory WILL be on sys.path
SITE_PACKAGES = None
for entry in sys.path:
if 'site-packages' in entry:
SITE_PACKAGES = entry
break
# Under a virtualenv, the python "binary" is under Scripts already.
# Well, not the binary, but the Python DLLs
PYTHON_EXECUTABLE_DIRECTORY = PYTHON_SCRIPTS_DIR = os.path.dirname(sys.executable)
# Requests is a Salt dependency, it's safe to import, but...
try:
import requests
HAS_REQUESTS = True
except ImportError:
HAS_REQUESTS = False
IS_64_BITS = sys.maxsize > 2**32
SALT_REPO_URL = 'https://repo.saltstack.com/windows/dependencies/{}'.format(IS_64_BITS and 64 or 32)
DLLS = ("libeay32.dll", "ssleay32.dll", "OpenSSL_License.txt", "msvcr120.dll", "libsodium.dll")
for dll in DLLS:
outfile = os.path.join(PYTHON_EXECUTABLE_DIRECTORY, dll)
if os.path.exists(outfile):
continue
src_url = '{}/{}'.format(SALT_REPO_URL, dll)
if HAS_REQUESTS:
print('Downloading {} to {}'.format(src_url, outfile))
request = requests.get(src_url, allow_redirects=True)
with open(outfile, 'wb') as wfh:
wfh.write(request.content)
else:
print('ATTENTION: The python requests package is not installed, can\'t download {}'.format(src_url))
PYWIN32_SYSTEM32_DIR = os.path.join(SITE_PACKAGES, 'pywin32_system32')
if os.path.exists(PYWIN32_SYSTEM32_DIR):
for fname in os.listdir(PYWIN32_SYSTEM32_DIR):
if not fname.endswith('.dll'):
continue
spath = os.path.join(PYWIN32_SYSTEM32_DIR, fname)
dpath = spath.replace('pywin32_system32', 'win32')
print('Moving {} to {}'.format(spath, dpath))
shutil.move(spath, dpath)
print('Deleting {}'.format(PYWIN32_SYSTEM32_DIR))
shutil.rmtree(PYWIN32_SYSTEM32_DIR, ignore_errors=True)
if os.path.exists(PYTHON_SCRIPTS_DIR):
print('Searching for pywin32 scripts to delete')
for fname in os.listdir(PYTHON_SCRIPTS_DIR):
if not fname.startswith('pywin32_'):
continue
fpath = os.path.join(PYTHON_SCRIPTS_DIR, fname)
print('Deleting {}'.format(fpath))
os.unlink(fpath)
PYTHONWIN_DIR = os.path.join(SITE_PACKAGES, 'pythonwin')
if os.path.exists(PYTHONWIN_DIR):
print('Deleting {}'.format(PYTHONWIN_DIR))
shutil.rmtree(PYTHONWIN_DIR, ignore_errors=True)
PYCRPTO_NT_FILE = os.path.join(SITE_PACKAGES, 'Crypto', 'Random', 'OSRNG', 'nt.py')
if os.path.exists(PYCRPTO_NT_FILE):
with open(PYCRPTO_NT_FILE, 'r') as rfh:
contents = rfh.read()
new_contents = re.sub(
r'^import winrandom$',
'from Crypto.Random.OSRNG import winrandom',
contents,
count=1,
flags=re.MULTILINE
)
if contents != new_contents:
print('Patching {}'.format(PYCRPTO_NT_FILE))
with open(PYCRPTO_NT_FILE, 'w') as wfh:
wfh.write(new_contents)