Fix run_tests.py dependencies

This commit is contained in:
micbou 2018-12-11 07:20:26 +01:00
parent 51b6335b24
commit 6425e1d96f
No known key found for this signature in database
GPG Key ID: C7E8FD1F3BDA1E05

View File

@ -1,40 +1,37 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import argparse
import subprocess
import os.path as p
import glob import glob
import os
import os.path as p
import subprocess
import sys import sys
DIR_OF_THIS_SCRIPT = p.dirname( p.abspath( __file__ ) ) DIR_OF_THIS_SCRIPT = p.dirname( p.abspath( __file__ ) )
DIR_OF_THIRD_PARTY = p.join( DIR_OF_THIS_SCRIPT, 'third_party' ) DIR_OF_THIRD_PARTY = p.join( DIR_OF_THIS_SCRIPT, 'third_party' )
DIR_OF_YCMD_THIRD_PARTY = p.join( DIR_OF_THIRD_PARTY, 'ycmd', 'third_party' )
python_path = [] # We don't include python-future (not to be confused with pythonfutures) because
for folder in os.listdir( DIR_OF_THIRD_PARTY ): # it needs to be inserted in sys.path AFTER the standard library imports but we
python_path.append( p.abspath( p.join( DIR_OF_THIRD_PARTY, folder ) ) ) # can't do that with PYTHONPATH because the std lib paths are always appended to
for folder in os.listdir( DIR_OF_YCMD_THIRD_PARTY ): # PYTHONPATH. We do it correctly inside Vim because we have access to the right
# We skip python-future because it needs to be inserted in sys.path AFTER # sys.path. So for dev, we rely on python-future being installed correctly with
# the standard library imports but we can't do that with PYTHONPATH because #
# the std lib paths are always appended to PYTHONPATH. We do it correctly in # pip install -r python/test_requirements.txt
# prod in ycmd/utils.py because we have access to the right sys.path. #
# So for dev, we rely on python-future being installed correctly with # Pip knows how to install this correctly so that it doesn't matter where in
# pip install -r test_requirements.txt # sys.path the path is.
# python_path = [ p.join( DIR_OF_THIRD_PARTY, 'pythonfutures' ),
# Pip knows how to install this correctly so that it doesn't matter where in p.join( DIR_OF_THIRD_PARTY, 'requests-futures' ),
# sys.path the path is. p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'chardet' ),
if folder == 'python-future': p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'certifi' ),
continue p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'idna' ),
python_path.append( p.abspath( p.join( DIR_OF_YCMD_THIRD_PARTY, folder ) ) ) p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'requests' ),
p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'urllib3', 'src' ),
p.join( DIR_OF_THIRD_PARTY, 'ycmd' ) ]
if os.environ.get( 'PYTHONPATH' ): if os.environ.get( 'PYTHONPATH' ):
python_path.append( os.environ[ 'PYTHONPATH' ] ) python_path.append( os.environ[ 'PYTHONPATH' ] )
os.environ[ 'PYTHONPATH' ] = os.pathsep.join( python_path ) os.environ[ 'PYTHONPATH' ] = os.pathsep.join( python_path )
sys.path.insert( 1, p.abspath( p.join( DIR_OF_YCMD_THIRD_PARTY,
'argparse' ) ) )
import argparse
def RunFlake8(): def RunFlake8():
print( 'Running flake8' ) print( 'Running flake8' )