diff options
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -16,6 +16,9 @@ from __future__ import absolute_import, division, print_function import os import sys from distutils.command.build import build +import subprocess + +import pkg_resources from setuptools import find_packages, setup from setuptools.command.test import test @@ -30,6 +33,7 @@ with open(os.path.join(base_dir, "cryptography", "__about__.py")) as f: CFFI_DEPENDENCY = "cffi>=0.8" SIX_DEPENDENCY = "six>=1.4.1" +VECTORS_DEPENDENCY = "cryptography_vectors=={0}".format(about['__version__']) requirements = [ CFFI_DEPENDENCY, @@ -39,9 +43,14 @@ requirements = [ test_requirements = [ "pytest", "pretend", - "iso8601" + "iso8601", ] +# If there's no vectors locally that probably means we are in a tarball and +# need to go and get the matching vectors package from PyPi +if not os.path.exists(os.path.join(base_dir, "vectors/setup.py")): + test_requirements.append(VECTORS_DEPENDENCY) + class CFFIBuild(build): """ @@ -81,6 +90,13 @@ class PyTest(test): self.test_args = [] self.test_suite = True + # This means there's a vectors/ folder with the package in here. + # cd into it, install the vectors package and then refresh sys.path + if VECTORS_DEPENDENCY not in test_requirements: + subprocess.Popen([sys.executable, "setup.py", "install"], + cwd="vectors").communicate() + pkg_resources.get_distribution("cryptography_vectors").activate() + def run_tests(self): # Import here because in module scope the eggs are not loaded. import pytest |