Commit 88d79148 authored by Sander Bollen's avatar Sander Bollen

install numpy and cython on the fly

parent 55bf0c71
Pipeline #2567 passed with stage
in 1 minute and 31 seconds
...@@ -3,7 +3,5 @@ build: ...@@ -3,7 +3,5 @@ build:
tags: tags:
- docker - docker
script: script:
- pip install --upgrade Cython
- pip install --upgrade numpy
- pip install --upgrade pip setuptools wheel - pip install --upgrade pip setuptools wheel
- pip install '.' - pip install '.'
...@@ -7,20 +7,41 @@ setup.py ...@@ -7,20 +7,41 @@ setup.py
:license: MIT :license: MIT
""" """
from os.path import abspath, dirname, join from os.path import abspath, dirname, join
import sys
import pkg_resources
import subprocess
from setuptools import setup, find_packages from setuptools import setup, find_packages
try: # Temporarily install dependencies required by setup.py before trying to
from Cython.Build import cythonize # import them. From https://bitbucket.org/dholth/setup-requires
except ImportError: sys.path[0:0] = ['setup-requires']
raise NotImplementedError("Installing cython on the fly not yet supported") pkg_resources.working_set.add_entry('setup-requires')
try: def missing_requirements(specifiers):
import numpy as np for specifier in specifiers:
except ImportError: try:
raise NotImplementedError("Installing numpy on the fly not yet supported") pkg_resources.require(specifier)
except pkg_resources.DistributionNotFound:
yield specifier
def install_requirements(specifiers):
to_install = list(specifiers)
if to_install:
cmd = [sys.executable, "-m", "pip", "install",
"-t", "setup-requires"] + to_install
subprocess.call(cmd)
requires = ['cython', 'numpy']
install_requirements(missing_requirements(requires))
from Cython.Build import cythonize
import numpy as np
readme_file = join(abspath(dirname(__file__)), "README.md") readme_file = join(abspath(dirname(__file__)), "README.md")
with open(readme_file) as desc_handle: with open(readme_file) as desc_handle:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment