Merge branch 'binary_fix_pip_bin_env' of https://github.com/cmcmarrow/salt into binary_fix_pip_bin_env

This commit is contained in:
cmcmarrow 2020-02-03 13:20:07 -08:00
commit 82b39d26f8
No known key found for this signature in database
GPG key ID: 62FAA6B3AC79AD2F
15 changed files with 46 additions and 80 deletions

View file

@ -15,7 +15,6 @@ repos:
- --include=requirements/base.txt
- --include=requirements/zeromq.txt
- --include=requirements/pytest.txt
- --remove-line=^pycrypto==(.*)$
- id: pip-tools-compile
alias: compile-darwin-py2.7-zmq-requirements
@ -30,7 +29,6 @@ repos:
- --include=requirements/base.txt
- --include=requirements/zeromq.txt
- --include=requirements/pytest.txt
- --remove-line=^pycrypto==(.*)$
- --passthrough-line-from-input=^pyobjc(.*)$
- id: pip-tools-compile
@ -46,7 +44,6 @@ repos:
- --include=requirements/base.txt
- --include=requirements/zeromq.txt
- --include=requirements/pytest.txt
- --remove-line=^pycrypto==(.*)$
- id: pip-tools-compile
alias: compile-cloud-py2.7-requirements
@ -99,7 +96,6 @@ repos:
- --include=requirements/base.txt
- --include=requirements/zeromq.txt
- --include=requirements/pytest.txt
- --remove-line=^pycrypto==(.*)$
- id: pip-tools-compile
alias: compile-cloud-py3.4-requirements
@ -132,7 +128,6 @@ repos:
- --include=requirements/base.txt
- --include=requirements/zeromq.txt
- --include=requirements/pytest.txt
- --remove-line=^pycrypto==(.*)$
- id: pip-tools-compile
alias: compile-darwin-py3.5-zmq-requirements
@ -147,7 +142,6 @@ repos:
- --include=requirements/base.txt
- --include=requirements/zeromq.txt
- --include=requirements/pytest.txt
- --remove-line=^pycrypto==(.*)$
- --passthrough-line-from-input=^pyobjc(.*)$
- id: pip-tools-compile
@ -163,7 +157,6 @@ repos:
- --include=requirements/base.txt
- --include=requirements/zeromq.txt
- --include=requirements/pytest.txt
- --remove-line=^pycrypto==(.*)$
- id: pip-tools-compile
alias: compile-cloud-py3.5-requirements
@ -234,7 +227,6 @@ repos:
- --include=requirements/base.txt
- --include=requirements/zeromq.txt
- --include=requirements/pytest.txt
- --remove-line=^pycrypto==(.*)$
- id: pip-tools-compile
alias: compile-darwin-py3.6-zmq-requirements
@ -249,7 +241,6 @@ repos:
- --include=requirements/base.txt
- --include=requirements/zeromq.txt
- --include=requirements/pytest.txt
- --remove-line=^pycrypto==(.*)$
- --passthrough-line-from-input=^pyobjc(.*)$
- id: pip-tools-compile
@ -265,7 +256,6 @@ repos:
- --include=requirements/base.txt
- --include=requirements/zeromq.txt
- --include=requirements/pytest.txt
- --remove-line=^pycrypto==(.*)$
- id: pip-tools-compile
alias: compile-cloud-py3.6-requirements
@ -336,7 +326,6 @@ repos:
- --include=requirements/base.txt
- --include=requirements/zeromq.txt
- --include=requirements/pytest.txt
- --remove-line=^pycrypto==(.*)$
- id: pip-tools-compile
alias: compile-darwin-py3.7-zmq-requirements
@ -351,7 +340,6 @@ repos:
- --include=requirements/base.txt
- --include=requirements/zeromq.txt
- --include=requirements/pytest.txt
- --remove-line=^pycrypto==(.*)$
- --passthrough-line-from-input=^pyobjc(.*)$
- id: pip-tools-compile
@ -367,7 +355,6 @@ repos:
- --include=requirements/base.txt
- --include=requirements/zeromq.txt
- --include=requirements/pytest.txt
- --remove-line=^pycrypto==(.*)$
- id: pip-tools-compile
alias: compile-cloud-py3.7-requirements

View file

@ -1,2 +1,2 @@
pycryptodome; sys.platform != 'win32'
pycrypto>=2.6.1; sys.platform not in 'win32,darwin'
pycryptodomex; sys.platform == 'win32'

View file

@ -23,9 +23,6 @@ more-itertools==5.0.0
moto
paramiko>=2.1.6
psutil
# Let's install pycryptodome instead of pycrypto because of pycrypto's outstanding security issues
# PyCrypto, if pulled, will be removed from the generated static requirements
pycryptodome
pygit2
pyinotify
pyopenssl

View file

@ -87,7 +87,7 @@ pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5
pycparser==2.19
pycryptodome==3.8.1 ; sys_platform != "win32"
pycryptodome==3.8.1
pynacl==1.3.0 # via paramiko
pyopenssl==19.0.0
pyparsing==2.4.5 # via packaging

View file

@ -85,7 +85,8 @@ pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via paramiko, pyasn1-modules, rsa
pycparser==2.19 # via cffi
pycryptodome==3.8.1 ; sys_platform != "win32"
pycrypto==2.6.1 ; sys_platform not in "win32,darwin"
pycryptodome==3.8.1 # via python-jose
pygit2==0.28.2
pyinotify==0.9.6
pynacl==1.3.0 # via paramiko

View file

@ -75,7 +75,8 @@ pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via paramiko, pyasn1-modules, rsa
pycparser==2.19 # via cffi
pycryptodome==3.8.1 ; sys_platform != "win32"
pycrypto==2.6.1 ; sys_platform not in "win32,darwin"
pycryptodome==3.8.1 # via python-jose
pygit2==0.28.2
pyinotify==0.9.6
pynacl==1.3.0 # via paramiko

View file

@ -78,7 +78,7 @@ pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5
pycparser==2.19
pycryptodome==3.8.1 ; sys_platform != "win32"
pycryptodome==3.8.1
pynacl==1.3.0 # via paramiko
pyopenssl==19.0.0
pyparsing==2.4.5 # via packaging

View file

@ -75,7 +75,8 @@ pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via paramiko, pyasn1-modules, rsa
pycparser==2.19 # via cffi
pycryptodome==3.8.1 ; sys_platform != "win32"
pycrypto==2.6.1 ; sys_platform not in "win32,darwin"
pycryptodome==3.8.1 # via python-jose
pygit2==0.28.2
pyinotify==0.9.6
pynacl==1.3.0 # via paramiko

View file

@ -77,7 +77,7 @@ pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5
pycparser==2.19
pycryptodome==3.8.1 ; sys_platform != "win32"
pycryptodome==3.8.1
pynacl==1.3.0 # via paramiko
pyopenssl==19.0.0
pyparsing==2.4.5 # via packaging

View file

@ -74,7 +74,8 @@ pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via paramiko, pyasn1-modules, rsa
pycparser==2.19 # via cffi
pycryptodome==3.8.1 ; sys_platform != "win32"
pycrypto==2.6.1 ; sys_platform not in "win32,darwin"
pycryptodome==3.8.1 # via python-jose
pygit2==0.28.2
pyinotify==0.9.6
pynacl==1.3.0 # via paramiko

View file

@ -77,7 +77,7 @@ pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5
pycparser==2.19
pycryptodome==3.8.1 ; sys_platform != "win32"
pycryptodome==3.8.1
pynacl==1.3.0 # via paramiko
pyopenssl==19.0.0
pyparsing==2.4.5 # via packaging

View file

@ -11,6 +11,7 @@ atomicwrites==1.3.0 # via pytest
attrs==19.1.0 # via pytest
aws-xray-sdk==0.95 # via moto
backports.functools-lru-cache==1.5 # via cheroot
backports.ssl-match-hostname==3.7.0.1 # via websocket-client
bcrypt==3.1.6 # via paramiko
boto3==1.9.132
boto==2.49.0
@ -73,7 +74,8 @@ pyaml==19.4.1 # via moto
pyasn1-modules==0.2.4 # via google-auth
pyasn1==0.4.5 # via paramiko, pyasn1-modules, rsa
pycparser==2.19 # via cffi
pycryptodome==3.8.1 ; sys_platform != "win32"
pycrypto==2.6.1 ; sys_platform not in "win32,darwin"
pycryptodome==3.8.1 # via python-jose
pygit2==0.28.2
pyinotify==0.9.6
pynacl==1.3.0 # via paramiko

View file

@ -553,3 +553,29 @@ def salt_extend(extension, name, description, salt_dir, merge):
description=description,
salt_dir=salt_dir,
merge=merge)
def salt_unity():
'''
Change the args and redirect to another salt script
'''
avail = []
for fun in dir(sys.modules[__name__]):
if fun.startswith('salt'):
avail.append(fun[5:])
if len(sys.argv) < 2:
msg = 'Must pass in a salt command, available commands are:'
for cmd in avail:
msg += '\n{0}'.format(cmd)
print(msg)
sys.exit(1)
cmd = sys.argv[1]
if cmd not in avail:
# Fall back to the salt command
sys.argv[0] = 'salt'
s_fun = salt_main
else:
sys.argv[0] = 'salt-{0}'.format(cmd)
sys.argv.pop(1)
s_fun = getattr(sys.modules[__name__], 'salt_{0}'.format(cmd))
s_fun()

56
scripts/salt-unity Normal file → Executable file
View file

@ -1,57 +1,7 @@
#!/usr/bin/env python2
#!/usr/bin/env python
# Import python libs
import sys
# Import salt libs
import salt.scripts
import salt.utils.platform
def get_avail():
'''
Return the available salt commands
'''
ret = []
for fun in dir(salt.scripts):
if fun.startswith('salt'):
ret.append(fun[5:])
return ret
def redirect():
'''
Change the args and redirect to another salt script
'''
avail = get_avail()
if len(sys.argv) < 2:
msg = 'Must pass in a salt command, available commands are:'
for cmd in avail:
msg += '\n{0}'.format(cmd)
print(msg)
sys.exit(1)
cmd = sys.argv[1]
if cmd not in avail:
# Fall back to the salt command
sys.argv[0] = 'salt'
s_fun = salt.scripts.salt_main
else:
sys.argv[0] = 'salt-{0}'.format(cmd)
sys.argv.pop(1)
s_fun = getattr(salt.scripts, 'salt_{0}'.format(cmd))
s_fun()
from salt.scripts import salt_unity
if __name__ == '__main__':
if salt.utils.platform.is_windows():
# Since this file does not have a '.py' extension, when running on
# Windows, spawning any addional processes will fail due to Python
# not being able to load this 'module' in the new process.
# Work around this by creating a '.pyc' file which will enable the
# spawned process to load this 'module' and proceed.
import os.path
import py_compile
cfile = os.path.splitext(__file__)[0] + '.pyc'
if not os.path.exists(cfile):
py_compile.compile(__file__, cfile)
redirect()
salt_unity()

View file

@ -206,7 +206,7 @@ def _parse_requirements_file(requirements_file):
except ValueError:
pkg, pyverspec = line, ''
pyverspec = pyverspec.strip()
if pyverspec:
if pyverspec and (not pkg.startswith('pycrypto') or pkg.startswith('pycryptodome')):
_, op, ver = pyverspec.split(' ', 2)
if not _check_ver(platform.python_version(), _parse_op(op), _parse_ver(ver)):
continue