问题
I need to add rjsmin
to my dependencies via install_require
in a setup.py.
rjsmin
offers a way to disable the c-extension by using the --without-c-extensions
switch like following
python setup.py install --without-c-extensions
I wonder, how to add this switch to the install_require
string.
回答1:
You need to provide an --install-option
or --global-option
along with the requirement text.
You can refer the doc here
回答2:
I solved my problem of installing dependencies with global-options
by sub-classing setuptools.command.install
class and overriding its run()
method, like following code -
from setuptools import setup
from setuptools.command.install import install
from subprocess import call
class CustomInstall(install):
def run(self):
install.run(self)
call(['pip', 'install', 'pycurl', '--global-option=--with-nss'])
setup( ...
cmdclass={
'install': CustomInstall,
},
)
Here, I am installing pycurl
with global option --with-nss
来源:https://stackoverflow.com/questions/31805385/setup-py-install-require-with-options