You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before, I use this command to pass arguments to setup.py to modify the wheel name and version suffix flexibility. python setup.py bdist_wheel --project_name my_test_project --weekly_build
And my setyp.py use the following codes.
if '--project_name' in sys.argv:
project_name_idx = sys.argv.index('--project_name')
project_name = sys.argv[project_name_idx + 1]
sys.argv.remove('--project_name')
sys.argv.pop(project_name_idx)
if "--weekly_build" in sys.argv:
VERSION = _VERSION + ".dev"
sys.argv.remove("--weekly_build")
project_name = project_name+"weekly"
It warning that avoid running setup.py directly. So I want to use the command python -m build .
I find it has a flag "--config-setting", and I use the command python -m build -w -n -C="--build-option=--project_name" -C="--build-option=test_project" refers to this issue
But I don't know how to modify the codes in setup.py to receive the argument "project_name".
Can you help me to solve it?
The text was updated successfully, but these errors were encountered:
I think there are two ways. The most flexible is to add a custom backend, and process them there. This would allow any form of config setting, and not just ones prefixed by --build-option. But this seems heavy for this sort of thing. I'd say it's exactly the same concept, though, as processing sys.argv before. You'd have to figure out how to pass something through to setup.py this way, though. Possibly by transforming the option then using the built-in system mentioned below 🤦? Or with a global or similar. :/
The built-in way would be to add them via setuptools' option system. I believe you'd do this by overriding the build command with a custom one and adding an option (this is technically how you should be doing this now, too; I don't think you were ever supposed to process sys.argv yourself).
Before, I use this command to pass arguments to setup.py to modify the wheel name and version suffix flexibility.
python setup.py bdist_wheel --project_name my_test_project --weekly_build
And my setyp.py use the following codes.
It warning that avoid running
setup.py
directly. So I want to use the commandpython -m build
.I find it has a flag "--config-setting", and I use the command
python -m build -w -n -C="--build-option=--project_name" -C="--build-option=test_project"
refers to this issueBut I don't know how to modify the codes in setup.py to receive the argument "project_name".
Can you help me to solve it?
The text was updated successfully, but these errors were encountered: