2019-10-25 19:28:44 +00:00
|
|
|
from typing import Text
|
|
|
|
|
|
|
|
from .base import PackageManager
|
|
|
|
from .requirements import SimpleSubstitution
|
|
|
|
|
|
|
|
|
|
|
|
class CythonRequirement(SimpleSubstitution):
|
|
|
|
|
2020-02-04 16:06:25 +00:00
|
|
|
name = ("cython", "numpy", )
|
2019-10-25 19:28:44 +00:00
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
|
|
super(CythonRequirement, self).__init__(*args, **kwargs)
|
|
|
|
|
|
|
|
def match(self, req):
|
|
|
|
# match both Cython & cython
|
2020-02-04 16:06:25 +00:00
|
|
|
return req.name and req.name.lower() in self.name
|
2019-10-25 19:28:44 +00:00
|
|
|
|
|
|
|
def replace(self, req):
|
|
|
|
"""
|
|
|
|
Replace a requirement
|
|
|
|
:raises: ValueError if version is pre-release
|
|
|
|
"""
|
|
|
|
# install Cython before
|
|
|
|
PackageManager.out_of_scope_install_package(str(req))
|
|
|
|
return Text(req)
|