Using setuptools with install parameters

995 Views Asked by At

Is there a way to pass install args through install_requires in setuptools?

What I'm trying to do specifically is install PyAMF using the --disable-ext arg. I've tried variations of:

from setuptools import setup

setup(
    install_requires=["pyamf[disable-ext]==0.6.1"]
)

But the args don't seem to be passed that way (I may be misunderstanding the usage of [] in the install_requires context though).

Edit:

As Epic_orange pointed out, of course I can do this manually with python setup.py --disable-ext, but I'm trying to automate this. My current solution is scripted, but I'm not happy with how this single package stands alone and I'm trying to find a way to stick it in with the rest of the dependencies.

1

There are 1 best solutions below

1
On

use it from the command line. eg:

python setup.py --disable-ext

EDIT:

im not familiar with PyAMF but you could have it run itsself again from the command line with an argument if it dosent have that argument:

   import subprocess,sys
   if len(sys.argv)==1: 
       subprocess.call('python setup.py --disable-ext')
       exit()
   #if it reaches here it will have that argument
   from setuptools import setup

   setup(
         install_requires=["pyamf[disable-ext]==0.6.1"]
   )