Check the commands and respond appropriately. Disable broken commands. Return a boolean value for whether or not to run the build or not (avoid parsing Cython and template files if False).
()
| 350 | |
| 351 | |
| 352 | def parse_setuppy_commands(): |
| 353 | """Check the commands and respond appropriately. Disable broken commands. |
| 354 | |
| 355 | Return a boolean value for whether or not to run the build or not (avoid |
| 356 | parsing Cython and template files if False). |
| 357 | """ |
| 358 | args = sys.argv[1:] |
| 359 | |
| 360 | if not args: |
| 361 | # User forgot to give an argument probably, let setuptools handle that. |
| 362 | return True |
| 363 | |
| 364 | info_commands = ['--help-commands', '--name', '--version', '-V', |
| 365 | '--fullname', '--author', '--author-email', |
| 366 | '--maintainer', '--maintainer-email', '--contact', |
| 367 | '--contact-email', '--url', '--license', '--description', |
| 368 | '--long-description', '--platforms', '--classifiers', |
| 369 | '--keywords', '--provides', '--requires', '--obsoletes', |
| 370 | 'version',] |
| 371 | |
| 372 | for command in info_commands: |
| 373 | if command in args: |
| 374 | return False |
| 375 | |
| 376 | # Note that 'alias', 'saveopts' and 'setopt' commands also seem to work |
| 377 | # fine as they are, but are usually used together with one of the commands |
| 378 | # below and not standalone. Hence they're not added to good_commands. |
| 379 | good_commands = ('develop', 'sdist', 'build', 'build_ext', 'build_py', |
| 380 | 'build_clib', 'build_scripts', 'bdist_wheel', 'bdist_rpm', |
| 381 | 'bdist_wininst', 'bdist_msi', 'bdist_mpkg', 'build_src', |
| 382 | 'bdist_egg') |
| 383 | |
| 384 | for command in good_commands: |
| 385 | if command in args: |
| 386 | return True |
| 387 | |
| 388 | # The following commands are supported, but we need to show more |
| 389 | # useful messages to the user |
| 390 | if 'install' in args: |
| 391 | print(textwrap.dedent(""" |
| 392 | Note: if you need reliable uninstall behavior, then install |
| 393 | with pip instead of using `setup.py install`: |
| 394 | |
| 395 | - `pip install .` (from a git repo or downloaded source |
| 396 | release) |
| 397 | - `pip install numpy` (last NumPy release on PyPI) |
| 398 | |
| 399 | """)) |
| 400 | return True |
| 401 | |
| 402 | if '--help' in args or '-h' in sys.argv[1]: |
| 403 | print(textwrap.dedent(""" |
| 404 | NumPy-specific help |
| 405 | ------------------- |
| 406 | |
| 407 | To install NumPy from here with reliable uninstall, we recommend |
| 408 | that you use `pip install .`. To install the latest NumPy release |
| 409 | from PyPI, use `pip install numpy`. |
no test coverage detected